diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-22 11:59:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:34 +0200 |
commit | 31e16a7413813293e3cccb6799eaa08b7af5af4e (patch) | |
tree | 45f06abbcf44652b58c3a2ad7485f64108994abd /unit-tests/test/script/lexer | |
parent | 8e3a8ffa6579a51f5a9351e1b99c07d3e1fbd234 (diff) |
Implement support for compound tests
Diffstat (limited to 'unit-tests/test/script/lexer')
-rw-r--r-- | unit-tests/test/script/lexer/assign-line.test | 8 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/buildfile | 3 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/driver.cxx | 7 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/script-line.test | 18 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/variable-line.test | 18 |
5 files changed, 51 insertions, 3 deletions
diff --git a/unit-tests/test/script/lexer/assign-line.test b/unit-tests/test/script/lexer/assign-line.test new file mode 100644 index 0000000..ce3e8a1 --- /dev/null +++ b/unit-tests/test/script/lexer/assign-line.test @@ -0,0 +1,8 @@ +# Note: this mode auto-expires after each token. +# +test.arguments += assign-line + +$* <";" >>EOO # semi-only +; +<newline> +EOO diff --git a/unit-tests/test/script/lexer/buildfile b/unit-tests/test/script/lexer/buildfile index a9f6be9..70be793 100644 --- a/unit-tests/test/script/lexer/buildfile +++ b/unit-tests/test/script/lexer/buildfile @@ -7,6 +7,7 @@ import libs = libbutl%lib{butl} src = token lexer diagnostics utility variable name test/script/{token lexer} -exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs test{variable.test} +exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs \ +test{script-line assign-line variable-line variable} include ../../../../build2/ diff --git a/unit-tests/test/script/lexer/driver.cxx b/unit-tests/test/script/lexer/driver.cxx index cd7110f..e37e29d 100644 --- a/unit-tests/test/script/lexer/driver.cxx +++ b/unit-tests/test/script/lexer/driver.cxx @@ -42,9 +42,12 @@ namespace build2 { cin.exceptions (istream::failbit | istream::badbit); - // The variable mode auto-expires so we need something underneath. + // Some modes auto-expire so we need something underneath. // - bool u (m == lexer_mode::variable); + bool u (m == lexer_mode::assign_line || + m == lexer_mode::variable_line || + m == lexer_mode::variable); + lexer l (cin, path ("stdin"), u ? lexer_mode::script_line : m); if (u) l.mode (m); diff --git a/unit-tests/test/script/lexer/script-line.test b/unit-tests/test/script/lexer/script-line.test new file mode 100644 index 0000000..b4fe3ef --- /dev/null +++ b/unit-tests/test/script/lexer/script-line.test @@ -0,0 +1,18 @@ +test.arguments += script-line + +$* <"cmd;" >>EOO # semi +'cmd' +; +<newline> +EOO + +$* <"cmd ;" >>EOO # semi-separated +'cmd' +; +<newline> +EOO + +$* <";" >>EOO # semi-only +; +<newline> +EOO diff --git a/unit-tests/test/script/lexer/variable-line.test b/unit-tests/test/script/lexer/variable-line.test new file mode 100644 index 0000000..543c6f9 --- /dev/null +++ b/unit-tests/test/script/lexer/variable-line.test @@ -0,0 +1,18 @@ +test.arguments += variable-line + +$* <"cmd;" >>EOO # semi +'cmd' +; +<newline> +EOO + +$* <"cmd ;" >>EOO # semi-separated +'cmd' +; +<newline> +EOO + +$* <";" >>EOO # semi-only +; +<newline> +EOO |