Some tests

Changed files
+59 -5
src
test
+1 -1
src/lib/ast.ml
··· 34 34 (a, None) 35 35 36 36 and separator_op : CST.separator_op -> separator = function 37 - | CST.SeparatorOp_Uppersand -> Uppersand 37 + | CST.SeparatorOp_Uppersand -> Ampersand 38 38 | CST.SeparatorOp_Semicolon -> Semicolon 39 39 40 40 and clist : CST.clist -> clist =
+6 -2
src/lib/eval.ml
··· 12 12 then redirection is setup, and finally functions/built-ins/commands are 13 13 executed. *) 14 14 15 - let word_component_to_string : Ast.word_component -> string = function 15 + let rec word_component_to_string : Ast.word_component -> string = function 16 16 | WordName s -> s 17 17 | WordLiteral s -> s 18 + | WordDoubleQuoted s -> 19 + String.concat " " (List.map word_component_to_string s) 18 20 | v -> 19 21 Fmt.failwith "Conversion of %a" Yojson.Safe.pp 20 22 (Ast.word_component_to_yojson v) ··· 157 159 | _ -> 158 160 let f, p = pipeline p in 159 161 f @@ execute_command p) 162 + | Noand_or, Nlist.Singleton (p, _) -> 163 + let f, p = pipeline p in 164 + f @@ execute_command p 160 165 | Noand_or, Nlist.Cons ((p, next_sep), rest) -> 161 166 let f, p = pipeline p in 162 167 fold (next_sep, f (execute_command p)) rest ··· 172 177 | None | Some _ -> 173 178 let f, p = pipeline p in 174 179 fold (next_sep, f (execute_command p)) rest) 175 - | _ -> assert false 176 180 in 177 181 fold (Noand_or, None) c 178 182 | _ -> Fmt.failwith "TODO!!!"
+1 -1
src/lib/sast.ml
··· 112 112 | IoHere_DLessDash_HereEnd of here_end * word 113 113 114 114 and here_end = HereEnd_Word of word 115 - and separator = Uppersand | Semicolon | Nosep 115 + and separator = Ampersand | Semicolon | Nosep 116 116 and sequential_sep = Semicolon | Newline 117 117 and word = word_cst 118 118 and word_cst = word_component list
+1 -1
test.sh
··· 1 - ls -jshjk || echo hello && ls =whkjed 1 + echo one; (sleep 1; echo two) & echo three
+4
test/dune
··· 1 + (cram 2 + (package osh) 3 + (deps %{bin:osh})) 4 + 1 5 (test 2 6 (name test_merry) 3 7 (libraries eio morbig))
+46
test/simple.t
··· 1 + A series of simple shell scripting tests for osh. 2 + 3 + 1. Variables and Parameters 4 + 5 + 1.1 Variable Subtitution 6 + 7 + $ cat >test.sh <<EOF 8 + > P="hello world" 9 + > echo \$P 10 + > EOF 11 + 12 + $ osh test.sh 13 + hello world 14 + 15 + 2. Pipelines with And|Or 16 + 17 + 2.1 Simple Or 18 + 19 + $ cat >test.sh <<EOF 20 + > sh -c "exit 1" || echo hello 21 + > EOF 22 + 23 + $ osh test.sh 24 + hello 25 + 26 + 2.2 Simple And 27 + 28 + $ cat >test.sh <<EOF 29 + > sh -c "exit 1" && echo hello 30 + > EOF 31 + 32 + $ osh test.sh 33 + [1] 34 + 35 + 2.3 Simple And and Or 36 + 37 + $ cat >test.sh <<EOF 38 + > echo first || sh -c "echo never && exit 1" && echo second 39 + > EOF 40 + 41 + $ osh test.sh 42 + first 43 + second 44 + 45 + 46 +