Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
let the users know about config changes concerning the contextes
[simgrid.git] / tools / tesh / basic.tesh
1 #! ./tesh
2
3 p This is a basic test
4
5 < TOTO \
6 TUTU
7 $ mkfile tmp_fich
8
9 $ cat tmp_fich
10 > TOTO TUTU
11
12 ! expect return 2
13 ! output ignore
14 < $ cat tmp_fich
15 < > TUTU TOTO
16 $ ${bindir:=.}/tesh 
17
18 $ rm tmp_fich
19
20 p And now, some multilines examples
21
22 p Really basic multiline
23 < a
24 < b
25 < c
26 < d
27 $ mkfile tmp_fich
28
29 $ cat tmp_fich
30 > a
31 > b
32 > c
33 > d
34
35 $ sed -n '$=' tmp_fich
36 > 4
37
38 $ rm tmp_fich
39
40 p Now, check for spaces in input
41
42 p * leading and trailing spaces...
43 <   a
44 <  b 
45 < c  
46 $ sed 's/ /_/g'
47 > __a
48 > _b_
49 > c__
50
51 p * empty lines...
52 < a
53 <
54 < c
55 $ sed '2s/^/b/'
56 > a
57 > b
58 > c
59
60 <
61 < b
62 < c
63 $ sed '1s/^/a/'
64 > a
65 > b
66 > c
67
68 p Now that input should be good, check for spaces in output
69
70 p * leading spaces...
71 < _x
72 $ sed 's/_/ /'
73 >  x
74
75 ! expect return 2
76 ! output ignore
77 < < _x
78 < $ sed 's/_/ /'
79 < > x
80 $ ${bindir:=.}/tesh
81
82 ! expect return 2
83 ! output ignore
84 < < x
85 < $ cat
86 < >  x
87 $ ${bindir:=.}/tesh
88
89 p * trailing spaces...
90 < x_
91 $ sed 's/_/ /'
92 > x 
93
94 ! expect return 2
95 ! output ignore
96 < < x_
97 < $ sed 's/_/ /'
98 < > x
99 $ ${bindir:=.}/tesh
100
101 ! expect return 2
102 ! output ignore
103 < < x
104 < $ cat
105 < > x 
106 $ ${bindir:=.}/tesh
107
108 p * empty lines...
109 < a
110 <
111 < c
112 $ cat
113 > a
114 >
115 > c
116
117 ! expect return 2
118 ! output ignore
119 < < a
120 < <
121 < < c
122 < $ cat
123 < > a
124 < > c
125 $ ${bindir:=.}/tesh 
126
127 ! expect return 2
128 ! output ignore
129 < < a
130 < < c
131 < $ cat
132 < > a
133 < >
134 < > c
135 $ ${bindir:=.}/tesh 
136
137 <
138 < b
139 < c
140 $ cat
141 >
142 > b
143 > c
144
145 ! expect return 2
146 ! output ignore
147 < <
148 < < b
149 < < c
150 < $ cat
151 < > b
152 < > c
153 $ ${bindir:=.}/tesh 
154
155 ! expect return 2
156 ! output ignore
157 < < b
158 < < c
159 < $ cat
160 < >
161 < > b
162 < > c
163 $ ${bindir:=.}/tesh