aboutsummaryrefslogtreecommitdiff
path: root/tests/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-10 00:26:54 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-11-15 16:46:10 +0300
commita7efabf301f23364ac2335c80c5e1e712bc43204 (patch)
treedded192f09627702bc8e0566c5c6032825d6920c /tests/test
parent05b1d9e89a94ee5594168073b8dc363fada987f1 (diff)
Add cat, false and true builtins
Diffstat (limited to 'tests/test')
-rw-r--r--tests/test/script/buildfile2
-rw-r--r--tests/test/script/builtin/buildfile5
-rw-r--r--tests/test/script/builtin/cat.test57
-rw-r--r--tests/test/script/builtin/echo.test11
-rw-r--r--tests/test/script/builtin/mkdir.test (renamed from tests/test/script/runner/mkdir.test)0
-rw-r--r--tests/test/script/builtin/touch.test (renamed from tests/test/script/runner/touch.test)11
-rw-r--r--tests/test/script/runner/buildfile5
-rw-r--r--tests/test/script/runner/redirect.test2
-rw-r--r--tests/test/script/runner/status.test4
9 files changed, 86 insertions, 11 deletions
diff --git a/tests/test/script/buildfile b/tests/test/script/buildfile
index e613013..82af4dd 100644
--- a/tests/test/script/buildfile
+++ b/tests/test/script/buildfile
@@ -2,6 +2,6 @@
# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-d = runner/ integration/
+d = builtin/ runner/ integration/
./: $d
include $d
diff --git a/tests/test/script/builtin/buildfile b/tests/test/script/builtin/buildfile
new file mode 100644
index 0000000..baa4996
--- /dev/null
+++ b/tests/test/script/builtin/buildfile
@@ -0,0 +1,5 @@
+# file : tests/test/script/builtin/buildfile
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+./: test{cat echo mkdir touch}
diff --git a/tests/test/script/builtin/cat.test b/tests/test/script/builtin/cat.test
new file mode 100644
index 0000000..7797906
--- /dev/null
+++ b/tests/test/script/builtin/cat.test
@@ -0,0 +1,57 @@
+# file : tests/test/script/runner/cat.test
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+: in
+:
+cat <<EOI >>EOO
+foo
+bar
+EOI
+foo
+bar
+EOO
+
+: dash
+:
+cat - <<EOI >>EOO
+foo
+bar
+EOI
+foo
+bar
+EOO
+
+: file
+:
+cat <<EOI >>>out;
+foo
+bar
+EOI
+cat out >>EOO
+foo
+bar
+EOO
+
+: in-repeat
+:
+cat - <<EOI >>EOO
+foo
+bar
+EOI
+foo
+bar
+EOO
+
+: non-existent
+:
+cat in 2>- != 0 # @@ REGEX
+
+: empty-path
+:
+: Cat an empty path.
+:
+cat '' 2>"cat: invalid path ''" == 1
+
+# @@ When piping is ready test cat on a big file to test it is asynchronous.
+#
diff --git a/tests/test/script/builtin/echo.test b/tests/test/script/builtin/echo.test
new file mode 100644
index 0000000..7f43aac
--- /dev/null
+++ b/tests/test/script/builtin/echo.test
@@ -0,0 +1,11 @@
+# file : tests/test/script/runner/echo.test
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+: string
+:
+echo foo >foo
+
+: strings
+:
+echo foo bar >"foo bar"
diff --git a/tests/test/script/runner/mkdir.test b/tests/test/script/builtin/mkdir.test
index 6b7b5c9..6b7b5c9 100644
--- a/tests/test/script/runner/mkdir.test
+++ b/tests/test/script/builtin/mkdir.test
diff --git a/tests/test/script/runner/touch.test b/tests/test/script/builtin/touch.test
index e9d9f68..4d2ff57 100644
--- a/tests/test/script/runner/touch.test
+++ b/tests/test/script/builtin/touch.test
@@ -15,12 +15,13 @@ rm a
: file-update
:
-: Test that existing file touch doesn't register cleanup. If it did then it
-: would be left dangling after 'rm' call and so test would fail.
+: Test that existing file touch doesn't fail.
:
-$* -f a;
-touch a;
-rm a
+cat <"" >>>a;
+touch a
+
+# @@ How we can test that touch of an existing file doesn't register a cleanup?
+#
: no-args
:
diff --git a/tests/test/script/runner/buildfile b/tests/test/script/runner/buildfile
index b9c0e69..e5f2761 100644
--- a/tests/test/script/runner/buildfile
+++ b/tests/test/script/runner/buildfile
@@ -4,9 +4,6 @@
import libs = libbutl%lib{butl}
-exe{driver}: cxx{driver} $libs test{cleanup mkdir redirect status touch}
-
-if ($cxx.target.class == "windows") # @@ TMP
- test{*}: ext = ".exe"
+exe{driver}: cxx{driver} $libs test{cleanup redirect status}
include ../../../../../build2/
diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test
index 68cc9aa..16c17d8 100644
--- a/tests/test/script/runner/redirect.test
+++ b/tests/test/script/runner/redirect.test
@@ -166,6 +166,6 @@ EOO
echo <foo 1>- : in-str
echo "foo" >foo : out-str
echo "foo" 2>foo 1>&2 : err-str
- cat <foo >foo : inout-str # @@ cat is not a builtin yet.
+ cat <foo >foo : inout-str
cat <foo 2>foo 1>&2 : inerr-str
}
diff --git a/tests/test/script/runner/status.test b/tests/test/script/runner/status.test
index f1ad5bf..00d7257 100644
--- a/tests/test/script/runner/status.test
+++ b/tests/test/script/runner/status.test
@@ -15,6 +15,10 @@ b = $build.driver -q --no-column --buildfile - <"./: test{testscript}" \
c = cat >>>testscript
test = \'$test\'
++if ($cxx.target.class == "windows")
+ ext = ".exe"
+end
+
# Successfull tests.
#
: eq-true