From 446692400a4f213dc97a6d8149b4a44de1ab9eb7 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Sun, 10 Dec 2017 20:08:43 -0500 Subject: [PATCH] Add a few more integration tests --- examples/advanced/cpu-model.ion | 2 +- examples/braces.ion | 8 ++++++++ examples/braces.out | 1 + examples/builtin_piping.ion | 1 + examples/builtin_piping.out | 1 + examples/continue.ion | 6 ++++++ examples/continue.out | 5 +++++ 7 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 examples/continue.ion create mode 100644 examples/continue.out diff --git a/examples/advanced/cpu-model.ion b/examples/advanced/cpu-model.ion index 37264def6..a89795eef 100644 --- a/examples/advanced/cpu-model.ion +++ b/examples/advanced/cpu-model.ion @@ -2,4 +2,4 @@ # Prints the model name of the CPU -echo @[grep 'model name' /proc/cpuinfo | head -1][3..5] +echo @(grep 'model name' /proc/cpuinfo | head -1)[3..5] diff --git a/examples/braces.ion b/examples/braces.ion index fbfed7a83..8bc78fecc 100644 --- a/examples/braces.ion +++ b/examples/braces.ion @@ -1,4 +1,9 @@ +# nested braces echo 1{A{1,2},B{1,2}} + +# permutating braces +echo {0,1}abc{2,3,4}def{5,6,7}{g,h,i} + # inclusive ranges echo {-1...1} echo {2...0} @@ -6,6 +11,7 @@ echo {a...c} echo {d...b} echo {A...C} echo {D...B} + # exclusive ranges echo {-1..2} echo {2..-1} @@ -13,6 +19,7 @@ echo {a..d} echo {d..a} echo {A..D} echo {D..A} + # inclusive stepped ranges echo {0..2...4} echo {a..2...e} @@ -20,6 +27,7 @@ echo {A..2...E} echo {0..-2...-4} echo {e..-2...a} echo {E..-2...A} + # exclusive stepped ranges echo {0..2..5} echo {a..2..f} diff --git a/examples/braces.out b/examples/braces.out index 02df6b2b0..e27ebdbfd 100644 --- a/examples/braces.out +++ b/examples/braces.out @@ -1,4 +1,5 @@ 1A1 1A2 1B1 1B2 +0abc2def5g 0abc2def5h 0abc2def5i 0abc2def6g 0abc2def6h 0abc2def6i 0abc2def7g 0abc2def7h 0abc2def7i 0abc3def5g 0abc3def5h 0abc3def5i 0abc3def6g 0abc3def6h 0abc3def6i 0abc3def7g 0abc3def7h 0abc3def7i 0abc4def5g 0abc4def5h 0abc4def5i 0abc4def6g 0abc4def6h 0abc4def6i 0abc4def7g 0abc4def7h 0abc4def7i 1abc2def5g 1abc2def5h 1abc2def5i 1abc2def6g 1abc2def6h 1abc2def6i 1abc2def7g 1abc2def7h 1abc2def7i 1abc3def5g 1abc3def5h 1abc3def5i 1abc3def6g 1abc3def6h 1abc3def6i 1abc3def7g 1abc3def7h 1abc3def7i 1abc4def5g 1abc4def5h 1abc4def5i 1abc4def6g 1abc4def6h 1abc4def6i 1abc4def7g 1abc4def7h 1abc4def7i -1 0 1 2 1 0 a b c diff --git a/examples/builtin_piping.ion b/examples/builtin_piping.ion index 30a70e913..8962861ba 100644 --- a/examples/builtin_piping.ion +++ b/examples/builtin_piping.ion @@ -1,4 +1,5 @@ matches Foo '([A-Z])\w+' && echo true matches foo '([A-Z])\w+' || echo false +echo foo | cat read foo <<< $(echo bar) echo $foo diff --git a/examples/builtin_piping.out b/examples/builtin_piping.out index cd0c5dc59..abd1f9656 100644 --- a/examples/builtin_piping.out +++ b/examples/builtin_piping.out @@ -1,3 +1,4 @@ true false +foo bar diff --git a/examples/continue.ion b/examples/continue.ion new file mode 100644 index 000000000..c879922c7 --- /dev/null +++ b/examples/continue.ion @@ -0,0 +1,6 @@ +for value in 1...10 + if test 0 -eq $(( value % 2 )) + continue + end + echo $value +end \ No newline at end of file diff --git a/examples/continue.out b/examples/continue.out new file mode 100644 index 000000000..2738e8e70 --- /dev/null +++ b/examples/continue.out @@ -0,0 +1,5 @@ +1 +3 +5 +7 +9