From 77410b0cdde47219d6c6a36533fcb9354f17c3dd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 6 Mar 2019 23:06:30 +0300 Subject: Use new setup for unit tests --- unit-tests/lexer/buildfile | 6 -- unit-tests/lexer/buildspec.testscript | 16 ---- unit-tests/lexer/comment.testscript | 139 ---------------------------------- unit-tests/lexer/driver.cxx | 98 ------------------------ unit-tests/lexer/eval.testscript | 76 ------------------- unit-tests/lexer/quoting.testscript | 108 -------------------------- 6 files changed, 443 deletions(-) delete mode 100644 unit-tests/lexer/buildfile delete mode 100644 unit-tests/lexer/buildspec.testscript delete mode 100644 unit-tests/lexer/comment.testscript delete mode 100644 unit-tests/lexer/driver.cxx delete mode 100644 unit-tests/lexer/eval.testscript delete mode 100644 unit-tests/lexer/quoting.testscript (limited to 'unit-tests/lexer') diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile deleted file mode 100644 index b7cc4c6..0000000 --- a/unit-tests/lexer/buildfile +++ /dev/null @@ -1,6 +0,0 @@ -# file : unit-tests/lexer/buildfile -# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -include ../../build2/ -exe{driver}: {hxx cxx}{*} ../../build2/libue{b} testscript{*} diff --git a/unit-tests/lexer/buildspec.testscript b/unit-tests/lexer/buildspec.testscript deleted file mode 100644 index 71568ae..0000000 --- a/unit-tests/lexer/buildspec.testscript +++ /dev/null @@ -1,16 +0,0 @@ -# file : unit-tests/lexer/buildspec.testscript -# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -test.arguments = buildspec - -: punctuation -: -$* <:'x,x(x)' >>EOO -'x' -, -'x' - ( -'x' -) -EOO diff --git a/unit-tests/lexer/comment.testscript b/unit-tests/lexer/comment.testscript deleted file mode 100644 index 44e1866..0000000 --- a/unit-tests/lexer/comment.testscript +++ /dev/null @@ -1,139 +0,0 @@ -# file : unit-tests/lexer/comment.testscript -# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -: single-line -: -{ - : only - : - $* <>:EOO - # comment - EOI - EOO - - : first - : - $* <>EOO - # comment - foo - EOI - 'foo' - - EOO - - : last - : - $* <>EOO - foo - # comment - EOI - 'foo' - - EOO - - : few - : - $* <>EOO - foo - # comment - # comment - EOI - 'foo' - - EOO - - : cont - : - $* <>EOO - foo - # comment\\ - bar - EOI - 'foo' - - 'bar' - - EOO - - : same - : - $* <>EOO - foo # comment - bar # comment - EOI - 'foo' - - 'bar' - - EOO -} - -: multi-line -: -{ - : only - : - $* <>:EOO - #\ - comment - comment - #\ - EOI - EOO - - : empty - : - $* <>:EOO - #\ - #\ - EOI - EOO - - : start-same - : - $* <>EOO - foo #\ - comment - comment - #\ - EOI - 'foo' - - EOO - - : end-same - : - $* <>EOO - #\ - comment - comment - foo #\ - bar - EOI - 'bar' - - EOO - - : end-not - : - $* <>EOO - #\ - comment - #\ not an end - foo #\ - bar - EOI - 'bar' - - EOO - - : unterm - : - $* <>EOE != 0 - #\ - comment - EOI - stdin:3:1: error: unterminated multi-line comment - EOE -} diff --git a/unit-tests/lexer/driver.cxx b/unit-tests/lexer/driver.cxx deleted file mode 100644 index a5cdb8d..0000000 --- a/unit-tests/lexer/driver.cxx +++ /dev/null @@ -1,98 +0,0 @@ -// file : unit-tests/lexer/driver.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include -#include - -#include -#include - -#include -#include - -using namespace std; - -namespace build2 -{ - // Usage: argv[0] [-q] [] - // - int - main (int argc, char* argv[]) - { - bool quote (false); - lexer_mode m (lexer_mode::normal); - - for (int i (1); i != argc; ++i) - { - string a (argv[i]); - - if (a == "-q") - quote = true; - else - { - if (a == "normal") m = lexer_mode::normal; - else if (a == "variable") m = lexer_mode::variable; - else if (a == "value") m = lexer_mode::value; - else if (a == "attribute") m = lexer_mode::attribute; - else if (a == "eval") m = lexer_mode::eval; - else if (a == "buildspec") m = lexer_mode::buildspec; - else assert (false); - break; - } - } - - try - { - cin.exceptions (istream::failbit | istream::badbit); - - // Most alternative modes auto-expire so we need something underneath. - // - lexer l (cin, path ("stdin")); - - if (m != lexer_mode::normal) - l.mode (m); - - // No use printing eos since we will either get it or loop forever. - // - for (token t (l.next ()); t.type != token_type::eos; t = l.next ()) - { - if (t.separated && t.type != token_type::newline) - cout << ' '; - - // Print each token on a separate line without quoting operators. - // - t.printer (cout, t, false); - - if (quote) - { - char q ('\0'); - switch (t.qtype) - { - case quote_type::single: q = 'S'; break; - case quote_type::double_: q = 'D'; break; - case quote_type::mixed: q = 'M'; break; - case quote_type::unquoted: break; - } - - if (q != '\0') - cout << " [" << q << (t.qcomp ? "/C" : "/P") << ']'; - } - - cout << endl; - } - } - catch (const failed&) - { - return 1; - } - - return 0; - } -} - -int -main (int argc, char* argv[]) -{ - return build2::main (argc, argv); -} diff --git a/unit-tests/lexer/eval.testscript b/unit-tests/lexer/eval.testscript deleted file mode 100644 index 6768756..0000000 --- a/unit-tests/lexer/eval.testscript +++ /dev/null @@ -1,76 +0,0 @@ -# file : unit-tests/lexer/eval.testscript -# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -test.arguments = eval - -: punctuation -: -$* <:'x:x{x}x[x]x$x?x,x(x)' >>EOO -'x' -: -'x' -{ -'x' -} -'x' -[ -'x' -] -'x' -$ -'x' -? -'x' -, -'x' -( -'x' -) -EOO - -: logical -: -$* <:'x|x||x&x&&x!x!!x)' >>EOO -'x|x' -|| -'x&x' -&& -'x' -! -'x' -! -! -'x' -) -EOO - -: comparison -: -$* <:'x=x==x!=xx>=)' >>EOO -'x=x' -== -'x' -!= -'x' -< -'x' -<= -'x' -> -'x' ->= -) -EOO - -: newline -: -$* <'x' >- 2>>EOE != 0 -stdin:1:2: error: newline in evaluation context -EOE - -: eof -: -$* <:'' 2>>EOE != 0 -stdin:1:1: error: unterminated evaluation context -EOE diff --git a/unit-tests/lexer/quoting.testscript b/unit-tests/lexer/quoting.testscript deleted file mode 100644 index e9767f2..0000000 --- a/unit-tests/lexer/quoting.testscript +++ /dev/null @@ -1,108 +0,0 @@ -# file : unit-tests/lexer/quoting.testscript -# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -test.options += -q - -: unquoted -: -$* <'foo' >>EOO -'foo' - -EOO - -: comp -: -{ - : single - : - $* <":'foo':" >>EOO - : - 'foo' [S/C] - : - - EOO - - : double - : - $* <':"foo":' >>EOO - : - 'foo' [D/C] - : - - EOO - - : single-empty - : - $* <"''" >>EOO - '' [S/C] - - EOO - - : double-empty - : - $* <'""' >>EOO - '' [D/C] - - EOO -} - -: part -{ - : quoted - { - : start - : Token start already quoted - : - $* <'"$foo"' >>EOO - '' [D/P] - $ [D/C] - 'foo' [D/P] - - EOO - - : end - : Token end still quoted - : - $* <'"foo$"' >>EOO - 'foo' [D/P] - $ [D/C] - '' [D/P] - - EOO - } - - : unquoted - { - : start - : Token starts with unquoted character - : - $* <'f"oo"' >>EOO - 'foo' [D/P] - - EOO - - : end - : Token continous with unquoted character - : - $* <'"fo"o' >>EOO - 'foo' [D/P] - - EOO - - : escape - : Token continous with unquoted escaped character - : - $* <'"fo"\"' >>EOO - 'fo"' [D/P] - - EOO - } -} - -: mixed -: -$* <"\"fo\"'o'" >>EOO -'foo' [M/P] - -EOO -- cgit v1.1