diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-22 17:13:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:35 +0200 |
commit | 0f7ecf29943c9d8112fff923d93eeadb99a816f3 (patch) | |
tree | 679a7e4f191d9b62aea19e1c41f5d8de45d42f5a /unit-tests/test | |
parent | 8bc5612e8ccddf38b0ebf6e89af2074ffde33c5f (diff) |
Add couple of testscript tests
Diffstat (limited to 'unit-tests/test')
-rw-r--r-- | unit-tests/test/script/lexer/buildfile | 2 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/comment.test | 113 |
2 files changed, 114 insertions, 1 deletions
diff --git a/unit-tests/test/script/lexer/buildfile b/unit-tests/test/script/lexer/buildfile index 70be793..856d35d 100644 --- a/unit-tests/test/script/lexer/buildfile +++ b/unit-tests/test/script/lexer/buildfile @@ -8,6 +8,6 @@ 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{script-line assign-line variable-line variable} +test{script-line assign-line variable-line variable comment} include ../../../../build2/ diff --git a/unit-tests/test/script/lexer/comment.test b/unit-tests/test/script/lexer/comment.test new file mode 100644 index 0000000..0092ed9 --- /dev/null +++ b/unit-tests/test/script/lexer/comment.test @@ -0,0 +1,113 @@ +# @@ This one should be moved to build2/lexer since we use base lexer +# functionality as is. +# +test.arguments += script-line + +# Single-line comments. + +$* <<EOI >>:EOO # single-only +# comment +EOI +EOO + +$* <<EOI >>EOO # single-first +# comment +foo +EOI +'foo' +<newline> +EOO + +$* <<EOI >>EOO # single-last +foo +# comment +EOI +'foo' +<newline> +EOO + +$* <<EOI >>EOO # single-few +foo +# comment +# comment +EOI +'foo' +<newline> +EOO + +$* <<EOI >>EOO # single-cont +foo +# comment\\ +bar +EOI +'foo' +<newline> +'bar' +<newline> +EOO + +$* <<EOI >>EOO # single-same +foo # comment +bar # comment +EOI +'foo' +<newline> +'bar' +<newline> +EOO + +# Multi-line comments. +# + +$* <<EOI >>:EOO # multi-only +#\\ +comment +comment +#\\ +EOI +EOO + +$* <<EOI >>:EOO # multi-empty +#\\ +#\\ +EOI +EOO + +$* <<EOI >>EOO # multi-start-same +foo #\\ +comment +comment +#\\ +EOI +'foo' +<newline> +EOO + +$* <<EOI >>EOO # multi-end-same +#\\ +comment +comment +foo #\\ +bar +EOI +'bar' +<newline> +EOO + +$* <<EOI >>EOO # multi-end-not +#\\ +comment +#\\ not an end +foo #\\ +bar +EOI +'bar' +<newline> +EOO + +$* <<EOI 2>>EOE != 0 # multi-unterm +#\\ +comment +EOI +stdin:3:1: error: unterminated multi-line comment +EOE |