From 720c5a33b6a49cf328fdd7611f49153cf8f60247 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Apr 2020 14:51:57 +0300 Subject: Separate tests and examples into individual packages Also make cli module to be explicitly enabled via the config.cli configuration variable. --- unit-tests/lexer/buildfile | 5 -- unit-tests/lexer/driver.cxx | 122 ---------------------------- unit-tests/lexer/testscript | 191 -------------------------------------------- 3 files changed, 318 deletions(-) delete mode 100644 unit-tests/lexer/buildfile delete mode 100644 unit-tests/lexer/driver.cxx delete mode 100644 unit-tests/lexer/testscript (limited to 'unit-tests/lexer') diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile deleted file mode 100644 index 8b73efe..0000000 --- a/unit-tests/lexer/buildfile +++ /dev/null @@ -1,5 +0,0 @@ -# file : unit-tests/lexer/buildfile -# license : MIT; see accompanying LICENSE file - -include ../../cli/ -exe{driver}: {hxx cxx}{*} ../../cli/libue{cli} testscript diff --git a/unit-tests/lexer/driver.cxx b/unit-tests/lexer/driver.cxx deleted file mode 100644 index f65bd2f..0000000 --- a/unit-tests/lexer/driver.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// file : unit-tests/lexer/driver.cxx -// author : Boris Kolpackov -// license : MIT; see accompanying LICENSE file - -#include -#include - -#include -#include - -using namespace std; - -const char* keywords[] = -{ - "source", - "include", - "namespace", - "class", - "signed", - "unsigned", - "bool", - "char", - "wchar_t", - "short", - "int", - "long", - "float", - "double" -}; - -const char* punctuation[] = { - ";", ",", ":", "::", "{", "}", /*"(", ")",*/ "=", "|"}; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " file.cli" << endl; - return 1; - } - - ifstream ifs; - ifs.exceptions (ifstream::failbit | ifstream::badbit); - ifs.open (argv[1]); - - lexer l (ifs, argv[1]); - - while (true) - { - token t (l.next ()); - - switch (t.type ()) - { - case token::t_eos: - { - cout << "" << endl; - return 0; - } - case token::t_keyword: - { - cout << "keyword: " << keywords[t.keyword ()] << endl; - break; - } - case token::t_identifier: - { - cout << "identifier: " << t.identifier () << endl; - break; - } - case token::t_punctuation: - { - cout << punctuation[t.punctuation ()] << endl; - break; - } - case token::t_cxx_path_lit: - { - cout << "c++ path: " << t.literal () << endl; - break; - } - case token::t_cli_path_lit: - { - cout << "cli path: " << t.literal () << endl; - break; - } - case token::t_string_lit: - { - cout << t.literal () << endl; - break; - } - case token::t_char_lit: - { - cout << t.literal () << endl; - break; - } - case token::t_bool_lit: - { - cout << t.literal () << endl; - break; - } - case token::t_int_lit: - { - cout << t.literal () << endl; - break; - } - case token::t_float_lit: - { - cout << t.literal () << endl; - break; - } - case token::t_call_expr: - { - cout << t.expression () << endl; - break; - } - case token::t_template_expr: - { - cout << t.expression () << endl; - break; - } - } - } -} diff --git a/unit-tests/lexer/testscript b/unit-tests/lexer/testscript deleted file mode 100644 index f001f54..0000000 --- a/unit-tests/lexer/testscript +++ /dev/null @@ -1,191 +0,0 @@ -# file : unit-tests/lexer/testscript -# license : MIT; see accompanying LICENSE file - -# @@ Give tests some meaningfull descriptions. -# - -: 000 -: -cat <=test.cli; -help -help-me --h ---help ---help-me ---help-me- -/h -/help-me -/help/me ---_ - -EOI -$* test.cli >>EOO -identifier: help -identifier: help-me -identifier: -h -identifier: --help -identifier: --help-me -identifier: --help-me- -identifier: /h -identifier: /help-me -identifier: /help -identifier: /me -identifier: --_ - -EOO - -: 001 -: -cat <=test.cli; -5 -123456 --12345 -- 1 -- -123 -EOI -$* test.cli >>EOO -5 -123456 --12345 --1 --123 - -EOO - -: 002 -: -cat <=test.cli; -'a' -'\n' -'\\' -'\0' -'\'' -'\xaf' -'\111' -EOI -$* test.cli >>EOO -'a' -'\n' -'\\' -'\0' -'\'' -'\xaf' -'\111' - -EOO - -: 003 -: -cat <=test.cli; -"abc"; -"a\nb"; -"abc\\"; -"aaa\0"; -"\""; -"a\xaf"; -"a\111"; -"abc""def"; -"abc" "def"; -"abc - def - - xyz"; -EOI -$* test.cli >>EOO -"abc" -; -"a\nb" -; -"abc\\" -; -"aaa\0" -; -"\"" -; -"a\xaf" -; -"a\111" -; -"abc""def" -; -"abc""def" -; -"abc - def - - xyz" -; - -EOO - -: 004 -: -cat <=test.cli; -include "foo/abc.hxx"; -include ; -include "c++:map"; -include ; -include "map.cli" -EOI -$* test.cli >>EOO -keyword: include -c++ path: "foo/abc.hxx" -; -keyword: include -c++ path: -; -keyword: include -c++ path: "map" -; -keyword: include -cli path: -; -keyword: include -cli path: "map.cli" - -EOO - -: 005 -: -cat <=test.cli; -(abc, 123 - 345, 12.34) - -EOI -$* test.cli >>EOO -(abc, 123 - 345, 12.34) - - -EOO - -: 006 -: -cat <=test.cli; -// c++ comment ; -/* c comment ; */ -; -"a" // foo -"b" -"a" /* foo -bar -baz */ "b"; -- // aaa -5; -- /* a -a -a*/ 5 -// eos -: -:: -EOI -$* test.cli >>EOO -; -"a""b""a""b" -; --5 -; --5 -: -:: - -EOO -- cgit v1.1