From 0f7ecf29943c9d8112fff923d93eeadb99a816f3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 22 Oct 2016 17:13:51 +0200 Subject: Add couple of testscript tests --- tests/test/script/testscript | 28 ++++---- unit-tests/test/script/lexer/buildfile | 2 +- unit-tests/test/script/lexer/comment.test | 113 ++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 13 deletions(-) create mode 100644 unit-tests/test/script/lexer/comment.test diff --git a/tests/test/script/testscript b/tests/test/script/testscript index 9b43467..9055062 100644 --- a/tests/test/script/testscript +++ b/tests/test/script/testscript @@ -46,8 +46,10 @@ EOE # @@ TMP Need does not compare test. # $* -i 1 <:"foo" >:"foo" # no-newline-str -#$* -i 1 <:"foo" >!"foo" # no-newline-str-fail1 -#$* -i 1 <"foo" >:!"foo" # no-newline-str-fail2 +#\ +$* -i 1 <:"foo" >!"foo" # no-newline-str-fail1 +$* -i 1 <"foo" >:!"foo" # no-newline-str-fail2 +#\ $* -i 1 <<:EOI >>:EOO # no-newline-doc foo @@ -55,14 +57,16 @@ EOI foo EOO -#$* -i 1 <<:EOI >>!EOO # no-newline-doc-fail1 -#foo -#EOI -#foo -#EOO +#\ +$* -i 1 <<:EOI >>!EOO # no-newline-doc-fail1 +foo +EOI +foo +EOO -#$* -i 1 <>:!EOO # no-newline-doc-fail2 -#foo -#EOI -#foo -#EOO +$* -i 1 <>:!EOO # no-newline-doc-fail2 +foo +EOI +foo +EOO +#\ 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. + +$* <>:EOO # single-only +# comment +EOI +EOO + +$* <>EOO # single-first +# comment +foo +EOI +'foo' + +EOO + +$* <>EOO # single-last +foo +# comment +EOI +'foo' + +EOO + +$* <>EOO # single-few +foo +# comment +# comment +EOI +'foo' + +EOO + +$* <>EOO # single-cont +foo +# comment\\ +bar +EOI +'foo' + +'bar' + +EOO + +$* <>EOO # single-same +foo # comment +bar # comment +EOI +'foo' + +'bar' + +EOO + +# Multi-line comments. +# + +$* <>:EOO # multi-only +#\\ +comment +comment +#\\ +EOI +EOO + +$* <>:EOO # multi-empty +#\\ +#\\ +EOI +EOO + +$* <>EOO # multi-start-same +foo #\\ +comment +comment +#\\ +EOI +'foo' + +EOO + +$* <>EOO # multi-end-same +#\\ +comment +comment +foo #\\ +bar +EOI +'bar' + +EOO + +$* <>EOO # multi-end-not +#\\ +comment +#\\ not an end +foo #\\ +bar +EOI +'bar' + +EOO + +$* <>EOE != 0 # multi-unterm +#\\ +comment +EOI +stdin:3:1: error: unterminated multi-line comment +EOE -- cgit v1.1