summaryrefslogtreecommitdiff
path: root/test/asset/shell
diff options
context:
space:
mode:
Diffstat (limited to 'test/asset/shell')
-rw-r--r--test/asset/shell/echo.et25
-rw-r--r--test/asset/shell/error-exit.et26
-rw-r--r--test/asset/shell/expansion.et20
-rw-r--r--test/asset/shell/logic.et14
-rw-r--r--test/asset/shell/pipe.et25
-rw-r--r--test/asset/shell/spawn.et13
-rw-r--r--test/asset/shell/working-directory.et19
7 files changed, 142 insertions, 0 deletions
diff --git a/test/asset/shell/echo.et b/test/asset/shell/echo.et
new file mode 100644
index 0000000..1e48cac
--- /dev/null
+++ b/test/asset/shell/echo.et
@@ -0,0 +1,25 @@
+test Echo:
+ node n
+ let echo_str = "echo"
+ let space_str = "a b"
+
+ shell on n as sh:
+ echo a b c
+ echo "a b c"
+ echo 'a b d'
+ echo a b " c d"
+
+ /bin/echo "abcd" xyz
+ "echo" a"a" "b"c d
+ $echo_str b $echo_str c
+
+ echo "$space_str"
+ echo $space_str
+ echo '$space_str'
+
+ echo \$ \" \\
+ echo "\""\""a"
+ echo "'" '"' '\\\' "\\"
+ echo a\ b\ \ c
+
+ echo \" \' \\ \$ \# \| \> \< \; \[ \] \{ \} \( \) \* \? \~ \& \!
diff --git a/test/asset/shell/error-exit.et b/test/asset/shell/error-exit.et
new file mode 100644
index 0000000..ecc2cd4
--- /dev/null
+++ b/test/asset/shell/error-exit.et
@@ -0,0 +1,26 @@
+test Default:
+ node n
+ shell on n as sh:
+ false
+
+test DisabledSuccess:
+ node n
+ shell on n as sh:
+ set +e
+ false
+ true
+
+test DisabledFailure:
+ node n
+ shell on n as sh:
+ set +e
+ false
+
+test Enabled:
+ node n
+ shell on n as sh:
+ set +e
+ false
+ set -e
+ false
+ true
diff --git a/test/asset/shell/expansion.et b/test/asset/shell/expansion.et
new file mode 100644
index 0000000..b947eb6
--- /dev/null
+++ b/test/asset/shell/expansion.et
@@ -0,0 +1,20 @@
+test Test:
+ node n
+
+ let str = "some string"
+ let int = 2
+ let num = 4.5
+ let list = [ "a b", "c d", "e", "f" ]
+ let ilist = [ 1 .. 5 ]
+ let cmd = "echo"
+ let cmdlist = [ "echo", "w", "x y", " z " ]
+ let special = [ "<", ">", "| &", ";" ]
+
+ shell on n as sh:
+ echo A $str B $int $num C
+ echo D $list E
+ echo F $ilist G
+ $cmd H I
+ $cmdlist J
+ $cmdlist K $ilist L $int M $special N
+ echo ${str}O P$str
diff --git a/test/asset/shell/logic.et b/test/asset/shell/logic.et
new file mode 100644
index 0000000..d1d4b32
--- /dev/null
+++ b/test/asset/shell/logic.et
@@ -0,0 +1,14 @@
+test NegateFalse:
+ node n
+ shell on n as sh:
+ ! false
+
+test NegateTrue:
+ node n
+ shell on n as sh:
+ ! true
+
+test NegateNothing:
+ node n
+ shell on n as sh:
+ !
diff --git a/test/asset/shell/pipe.et b/test/asset/shell/pipe.et
new file mode 100644
index 0000000..a00360a
--- /dev/null
+++ b/test/asset/shell/pipe.et
@@ -0,0 +1,25 @@
+test Pipe:
+ node n
+ shell on n as sh:
+ echo abcd | grep -o '[bc]*'
+ echo abcd | grep -o '[bcd]*' | grep -o '[ab]*'
+
+
+test Redirect:
+ node n
+ shell on n as sh:
+ echo a > file
+ echo b > file
+ echo c >> file
+ echo x
+ cat file
+ echo y
+ cat < file
+ echo z
+
+test PipeRedirect:
+ node n
+ shell on n as sh:
+ echo abcdefghi | grep -o '[b-h]*' | grep -o '[a-g]*' > file
+ cat < file | grep -o '[acegi]' | cat > file2
+ cat file2 - < file
diff --git a/test/asset/shell/spawn.et b/test/asset/shell/spawn.et
new file mode 100644
index 0000000..9d48e72
--- /dev/null
+++ b/test/asset/shell/spawn.et
@@ -0,0 +1,13 @@
+test ShellTrue:
+ node n
+ shell on n:
+ true
+
+ shell on n as sh:
+ true
+
+
+test ShellFalse:
+ node n
+ shell on n as sh:
+ false
diff --git a/test/asset/shell/working-directory.et b/test/asset/shell/working-directory.et
new file mode 100644
index 0000000..da31e2f
--- /dev/null
+++ b/test/asset/shell/working-directory.et
@@ -0,0 +1,19 @@
+test Test:
+ node n
+ shell on n as sh:
+ pwd
+ mkdir -p abc/def/ghi
+ cd abc/def
+ pwd
+ cd ..
+ pwd
+ cd def/ghi
+ pwd
+ cd -
+ pwd
+ cd -
+ pwd
+ cd
+ pwd
+ cd /tmp
+ pwd