Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Output of "wc" is not reliable (variable number of spaces).
[simgrid.git] / tools / tesh / basic.tesh
index d8c8f68..32289af 100644 (file)
@@ -9,10 +9,17 @@ $ mkfile tmp_fich
 $ cat tmp_fich
 > TOTO TUTU
 
+! expect return 2
+! output ignore
+< $ cat tmp_fich
+< > TUTU TOTO
+$ ${bindir:=.}/tesh --enable-coverage
+
 $ rm tmp_fich
 
 p And now, some multilines examples
 
+p Really basic multiline
 < a
 < b
 < c
@@ -25,27 +32,132 @@ $ cat tmp_fich
 > c
 > d
 
-$ wc -l tmp_fich
-> 4 tmp_fich
+$ sed -n '$=' tmp_fich
+> 4
 
 $ rm tmp_fich
 
-$ ${bindir:=.}/tesh --enable-coverage --log='log.thresh:info tesh.fmt:%m%n' basic2.tesh
-> Enable coverage
-> Test suite `basic2'
-> [basic2:3] Test sorting and filtering of output
-> [basic2:5] true
-> [basic2:8] true
-> [basic2:10] printf 'profiling: foo\\n'
-> [basic2:12] printf 'profiling: foo'
-> [basic2:15] printf 'profiling: foo\\n'
-> [basic2:18] printf 'profiling: foo'
-> [basic2:20] printf 'a\\nb\\nc\\nd\\n'
-> [basic2:26] printf 'a\\nb\\nc\\nd'
-> [basic2:33] printf 'c\\nd\\nb\\na\\n'
-> [basic2:40] printf 'c\\nd\\nb\\na'
-> [basic2:46] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
-> [basic2:52] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
-> [basic2:59] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
-> [basic2:66] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
-> Test suite `basic2' OK
+p Now, check for spaces in input
+
+p * leading and trailing spaces...
+<   a
+<  b 
+< c  
+$ sed 's/ /_/g'
+> __a
+> _b_
+> c__
+
+p * empty lines...
+< a
+<
+< c
+$ sed '2s/^/b/'
+> a
+> b
+> c
+
+<
+< b
+< c
+$ sed '1s/^/a/'
+> a
+> b
+> c
+
+p Now that input should be good, check for spaces in output
+
+p * leading spaces...
+< _x
+$ sed 's/_/ /'
+>  x
+
+! expect return 2
+! output ignore
+< < _x
+< $ sed 's/_/ /'
+< > x
+$ ${bindir:=.}/tesh --enable-coverage
+
+! expect return 2
+! output ignore
+< < x
+< $ cat
+< >  x
+$ ${bindir:=.}/tesh --enable-coverage
+
+p * trailing spaces...
+< x_
+$ sed 's/_/ /'
+> x 
+
+! expect return 2
+! output ignore
+< < x_
+< $ sed 's/_/ /'
+< > x
+$ ${bindir:=.}/tesh --enable-coverage
+
+! expect return 2
+! output ignore
+< < x
+< $ cat
+< > x 
+$ ${bindir:=.}/tesh --enable-coverage
+
+p * empty lines...
+< a
+<
+< c
+$ cat
+> a
+>
+> c
+
+! expect return 2
+! output ignore
+< < a
+< <
+< < c
+< $ cat
+< > a
+< > c
+$ ${bindir:=.}/tesh --enable-coverage
+
+! expect return 2
+! output ignore
+< < a
+< < c
+< $ cat
+< > a
+< >
+< > c
+$ ${bindir:=.}/tesh --enable-coverage
+
+<
+< b
+< c
+$ cat
+>
+> b
+> c
+
+! expect return 2
+! output ignore
+< <
+< < b
+< < c
+< $ cat
+< > b
+< > c
+$ ${bindir:=.}/tesh --enable-coverage
+
+! expect return 2
+! output ignore
+< < b
+< < c
+< $ cat
+< >
+< > b
+< > c
+$ ${bindir:=.}/tesh --enable-coverage