From cc6280af7eca660c916dc652066216acd474979d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 23 Jan 2019 21:47:38 +0300 Subject: Add testscript sleep builtin --- tests/test/script/builtin/sed.testscript | 2 +- tests/test/script/builtin/sleep.testscript | 31 ++++++++++++++++++++++++++++++ tests/test/script/builtin/test.testscript | 4 +++- tests/test/script/runner/exit.testscript | 2 +- tests/test/script/runner/set.testscript | 2 +- 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 tests/test/script/builtin/sleep.testscript (limited to 'tests/test/script') diff --git a/tests/test/script/builtin/sed.testscript b/tests/test/script/builtin/sed.testscript index 1665de2..e3c0965 100644 --- a/tests/test/script/builtin/sed.testscript +++ b/tests/test/script/builtin/sed.testscript @@ -109,7 +109,7 @@ $c <"sed -e 's/a//' a b" && $b 2>>/EOE != 0 testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr - sed: unexpected argument + sed: unexpected argument 'b' info: test id: 1 EOE } diff --git a/tests/test/script/builtin/sleep.testscript b/tests/test/script/builtin/sleep.testscript new file mode 100644 index 0000000..c43418d --- /dev/null +++ b/tests/test/script/builtin/sleep.testscript @@ -0,0 +1,31 @@ +# file : tests/test/script/builtin/sleep.testscript +# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +.include ../common.testscript + +: success +: +$c <'sleep 1' && $b + +: no-time +: +: Test passing no time interval. +: +$c <'sleep 2>"sleep: missing time interval" != 0' && $b + +: invalid-time +: +: Test passing invalid time interval. +: +$c <"sleep: invalid time interval '1a'" != 0 +EOI + +: unexpected-arg +: +: Test passing extra argument. +: +$c <"sleep: unexpected argument '1'" != 0 +EOI diff --git a/tests/test/script/builtin/test.testscript b/tests/test/script/builtin/test.testscript index c17b3b0..650f9ef 100644 --- a/tests/test/script/builtin/test.testscript +++ b/tests/test/script/builtin/test.testscript @@ -58,7 +58,9 @@ $c <'test -c a 2>"test: invalid option" == 2' && $b : : Test passing extra argument. : -$c <'test -f a b 2>"test: unexpected argument" == 2' && $b +$c <"test: unexpected argument 'b'" == 2 +EOI : empty-path : diff --git a/tests/test/script/runner/exit.testscript b/tests/test/script/runner/exit.testscript index 897cf65..261b02d 100644 --- a/tests/test/script/runner/exit.testscript +++ b/tests/test/script/runner/exit.testscript @@ -77,7 +77,7 @@ empty_id = '' : unexpected : $c <'exit "foo" "bar"' && $b 2>>EOE != 0 - testscript:1:1: error: unexpected argument + testscript:1:1: error: unexpected argument 'bar' info: test id: 1 EOE } diff --git a/tests/test/script/runner/set.testscript b/tests/test/script/runner/set.testscript index a795963..28d6686 100644 --- a/tests/test/script/runner/set.testscript +++ b/tests/test/script/runner/set.testscript @@ -53,7 +53,7 @@ : unexpected : $c <'set foo bar baz' && $b 2>>EOE != 0 - testscript:1:1: error: unexpected argument + testscript:1:1: error: unexpected argument 'baz' info: test id: 1 EOE -- cgit v1.1