aboutsummaryrefslogtreecommitdiff
path: root/tests/build
diff options
context:
space:
mode:
Diffstat (limited to 'tests/build')
-rw-r--r--tests/build/buildfile3
-rw-r--r--tests/build/lexer/buildfile1
-rw-r--r--tests/build/lexer/driver.cxx120
-rw-r--r--tests/build/parser/buildfile2
-rw-r--r--tests/build/parser/driver.cxx102
l---------tests/build/semantics/include/buildfile1
-rw-r--r--tests/build/semantics/include/includee11
-rw-r--r--tests/build/semantics/include/includee21
-rw-r--r--tests/build/semantics/include/includee41
-rw-r--r--tests/build/semantics/include/includer10
-rw-r--r--tests/build/semantics/include/nested/includee32
-rw-r--r--tests/build/semantics/include/nested/includee51
-rw-r--r--tests/build/semantics/include/test.std5
l---------tests/build/semantics/source/buildfile1
-rw-r--r--tests/build/semantics/source/nested/sourcee31
-rw-r--r--tests/build/semantics/source/sourcee11
-rw-r--r--tests/build/semantics/source/sourcee21
-rw-r--r--tests/build/semantics/source/sourcer9
-rw-r--r--tests/build/semantics/source/test.std5
19 files changed, 0 insertions, 268 deletions
diff --git a/tests/build/buildfile b/tests/build/buildfile
deleted file mode 100644
index 8d7e692..0000000
--- a/tests/build/buildfile
+++ /dev/null
@@ -1,3 +0,0 @@
-d=
-.: $d
-include $d
diff --git a/tests/build/lexer/buildfile b/tests/build/lexer/buildfile
deleted file mode 100644
index 415c64c..0000000
--- a/tests/build/lexer/buildfile
+++ /dev/null
@@ -1 +0,0 @@
-exe{driver}: cxx{driver ../../../build/{lexer diagnostics utility}}
diff --git a/tests/build/lexer/driver.cxx b/tests/build/lexer/driver.cxx
deleted file mode 100644
index f77656d..0000000
--- a/tests/build/lexer/driver.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-// file : tests/build/lexer/driver.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#include <string>
-#include <vector>
-#include <cassert>
-#include <sstream>
-#include <iostream>
-
-#include <build/token>
-#include <build/lexer>
-
-using namespace std;
-using namespace build;
-
-typedef vector<string> tokens;
-
-static tokens
-lex (const char*);
-
-int
-main ()
-{
- ostream cnull (nullptr);
- diag_stream = &cnull;
-
- // Whitespaces.
- //
- assert (lex ("") == tokens ({""}));
- assert (lex ("\n") == tokens ({""}));
- assert (lex ("\n\n") == tokens ({""}));
- assert (lex (" \t \n") == tokens ({""}));
- assert (lex ("#comment") == tokens ({""}));
- assert (lex (" #comment") == tokens ({""}));
- assert (lex ("#comment\n") == tokens ({""}));
- assert (lex ("#comment\\\n") == tokens ({""}));
- assert (lex ("#comment 1\n#comment2") == tokens ({""}));
-
- // Punctuation.
- //
- assert (lex (": \n { }") == tokens ({":", "\n", "{", "}", ""}));
-
- // Names.
- //
- assert (lex ("foo") == tokens ({"foo", ""}));
- assert (lex ("foo.bar") == tokens ({"foo.bar", ""}));
-
- // Escaping.
- //
- assert (lex (" \\\n") == tokens ({""}));
- assert (lex ("\\\nfoo") == tokens ({"foo", ""}));
- assert (lex (" \\ foo") == tokens ({" foo", ""}));
- assert (lex ("fo\\ o\\:") == tokens ({"fo o:", ""}));
- assert (lex ("foo\\\nbar") == tokens ({"foo\nbar", ""}));
- assert (lex ("foo \\\nbar") == tokens ({"foo", "bar", ""}));
-
- assert (lex (" \\") == tokens ({"<lexer error>"}));
- assert (lex (" foo\\") == tokens ({"<lexer error>"}));
-
- // Combinations.
- //
- assert (lex ("foo: bar") == tokens ({"foo", ":", "bar", ""}));
- assert (lex ("\n \nfoo: bar") == tokens ({"foo", ":", "bar", ""}));
- assert (lex ("foo: bar\n") == tokens ({"foo", ":", "bar", "\n", ""}));
- assert (lex ("foo: bar#comment") == tokens ({"foo", ":", "bar", ""}));
- assert (lex ("exe{foo}: obj{bar}") ==
- tokens ({"exe", "{", "foo", "}", ":", "obj", "{", "bar", "}", ""}));
- assert (lex ("foo: bar\nbaz: biz") ==
- tokens ({"foo", ":", "bar", "\n", "baz", ":", "biz", ""}));
- assert (lex ("foo: bar#comment\nbaz: biz") ==
- tokens ({"foo", ":", "bar", "\n", "baz", ":", "biz", ""}));
- assert (lex ("foo:#comment \\\nbar") ==
- tokens ({"foo", ":", "\n", "bar", ""}));
-}
-
-static tokens
-lex (const char* s)
-{
- tokens r;
- istringstream is (s);
-
- is.exceptions (istream::failbit | istream::badbit);
- lexer l (is, "");
-
- try
- {
- for (token t (l.next ());; t = l.next ())
- {
- const char* v (nullptr);
-
- switch (t.type ())
- {
- case token_type::eos: v= ""; break;
- case token_type::newline: v = "\n"; break;
- case token_type::colon: v = ":"; break;
- case token_type::lcbrace: v = "{"; break;
- case token_type::rcbrace: v = "}"; break;
- case token_type::name: v = t.name ().c_str (); break;
- }
-
- // cerr << t.line () << ':' << t.column () << ':' << v << endl;
-
- r.push_back (v);
-
- if (t.type () == token_type::eos)
- break;
- }
- }
- catch (const failed&)
- {
- r.push_back ("<lexer error>");
- }
- catch (const std::ios_base::failure&)
- {
- r.push_back ("<io error>");
- }
-
- return r;
-}
diff --git a/tests/build/parser/buildfile b/tests/build/parser/buildfile
deleted file mode 100644
index c924dcb..0000000
--- a/tests/build/parser/buildfile
+++ /dev/null
@@ -1,2 +0,0 @@
-exe{driver}: cxx{driver ../../../build/{lexer parser scope target native \
- prerequisite context diagnostics utility path timestamp}}
diff --git a/tests/build/parser/driver.cxx b/tests/build/parser/driver.cxx
deleted file mode 100644
index fef2f41..0000000
--- a/tests/build/parser/driver.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-// file : tests/build/parser/driver.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#include <cassert>
-#include <sstream>
-#include <iostream>
-
-#include <build/types>
-#include <build/scope>
-#include <build/target>
-#include <build/native>
-
-#include <build/lexer>
-#include <build/parser>
-
-using namespace std;
-using namespace build;
-
-static bool
-parse (const char*);
-
-int
-main ()
-{
- ostream cnull (nullptr);
- diag_stream = &cnull;
-
- target_types.insert (file::static_type);
- target_types.insert (exe::static_type);
- target_types.insert (obj::static_type);
-
- assert (parse (""));
- assert (parse ("foo:"));
- assert (parse ("foo bar:"));
- assert (parse ("foo:\nbar:"));
- assert (parse ("foo: bar"));
- assert (parse ("foo: bar baz"));
- assert (parse ("foo bar: baz biz"));
-
- assert (parse ("{foo}:"));
- assert (parse ("{foo bar}:"));
- assert (parse ("{{foo bar}}:"));
- assert (parse ("{{foo bar} {baz} {biz fox} fix}:"));
-
- assert (parse ("exe{foo}:"));
- assert (parse ("exe{foo bar}:"));
- assert (parse ("{exe{foo bar}}:"));
- assert (parse ("exe{{foo bar} fox}:"));
- assert (parse ("exe{foo}: obj{bar baz} biz.o file{fox}"));
-
- assert (!parse (":"));
- assert (!parse ("foo"));
- assert (!parse ("{"));
- assert (!parse ("{foo:"));
- assert (!parse ("{foo{:"));
- assert (!parse ("foo: bar:"));
- assert (!parse ("exe{foo:"));
-
- // Directory prefix.
- //
- assert (parse ("../{foo}: ../{bar}"));
- assert (parse ("../exe{foo}: ../obj{bar}"));
- assert (!parse ("../exe{exe{foo}}:"));
-
- // Directory scope.
- //
- assert (parse ("test/:\n{\n}"));
- assert (parse ("test/:\n{\n}\n"));
- assert (parse ("test/:\n{\nfoo:bar\n}"));
- assert (parse ("test/:\n{\nfoo:bar\n}"));
- assert (parse ("test/:\n{\nmore/:\n{\n}\n}"));
- assert (parse ("test/:\n{\nmore/:\n{\nfoo:{bar baz}\n}\n}"));
-
- assert (!parse ("test/:\n{"));
- assert (!parse ("test/:\n{\n"));
- assert (!parse ("test/:\n{\n:"));
- assert (!parse ("test/:\n{\n} foo: bar\n"));
- assert (!parse ("test/ foo:\n{\n}"));
- assert (!parse ("test foo/:\n{\n}"));
- assert (!parse ("test/ foo/:\n{\n}"));
-}
-
-static bool
-parse (const char* s)
-{
- istringstream is (s);
-
- is.exceptions (istream::failbit | istream::badbit);
- parser p;
-
- try
- {
- p.parse (is, path (), scopes[path::current ()]);
- }
- catch (const failed&)
- {
- return false;
- }
-
- return true;
-}
diff --git a/tests/build/semantics/include/buildfile b/tests/build/semantics/include/buildfile
deleted file mode 120000
index 361dcf4..0000000
--- a/tests/build/semantics/include/buildfile
+++ /dev/null
@@ -1 +0,0 @@
-includer \ No newline at end of file
diff --git a/tests/build/semantics/include/includee1 b/tests/build/semantics/include/includee1
deleted file mode 100644
index 70ed3fc..0000000
--- a/tests/build/semantics/include/includee1
+++ /dev/null
@@ -1 +0,0 @@
-print includee1 \ No newline at end of file
diff --git a/tests/build/semantics/include/includee2 b/tests/build/semantics/include/includee2
deleted file mode 100644
index 762825b..0000000
--- a/tests/build/semantics/include/includee2
+++ /dev/null
@@ -1 +0,0 @@
-print includee2
diff --git a/tests/build/semantics/include/includee4 b/tests/build/semantics/include/includee4
deleted file mode 100644
index 4964d81..0000000
--- a/tests/build/semantics/include/includee4
+++ /dev/null
@@ -1 +0,0 @@
-print includee4
diff --git a/tests/build/semantics/include/includer b/tests/build/semantics/include/includer
deleted file mode 100644
index 70527a5..0000000
--- a/tests/build/semantics/include/includer
+++ /dev/null
@@ -1,10 +0,0 @@
-include
-include includee1
-include includee1 ../include/includee2 # includee1 is skipped
-include nested/includee3
-nested/:
-{
- include includee5
- include ../includee2 # skipped
-}
-:
diff --git a/tests/build/semantics/include/nested/includee3 b/tests/build/semantics/include/nested/includee3
deleted file mode 100644
index 7196e82..0000000
--- a/tests/build/semantics/include/nested/includee3
+++ /dev/null
@@ -1,2 +0,0 @@
-print nested/includee3
-include ../includee4
diff --git a/tests/build/semantics/include/nested/includee5 b/tests/build/semantics/include/nested/includee5
deleted file mode 100644
index b4c9c74..0000000
--- a/tests/build/semantics/include/nested/includee5
+++ /dev/null
@@ -1 +0,0 @@
-print nested/includee5
diff --git a/tests/build/semantics/include/test.std b/tests/build/semantics/include/test.std
deleted file mode 100644
index 559584c..0000000
--- a/tests/build/semantics/include/test.std
+++ /dev/null
@@ -1,5 +0,0 @@
-includee1
-includee2
-nested/includee3
-includee4
-nested/includee5
diff --git a/tests/build/semantics/source/buildfile b/tests/build/semantics/source/buildfile
deleted file mode 120000
index b6d1987..0000000
--- a/tests/build/semantics/source/buildfile
+++ /dev/null
@@ -1 +0,0 @@
-sourcer \ No newline at end of file
diff --git a/tests/build/semantics/source/nested/sourcee3 b/tests/build/semantics/source/nested/sourcee3
deleted file mode 100644
index cdf51fb..0000000
--- a/tests/build/semantics/source/nested/sourcee3
+++ /dev/null
@@ -1 +0,0 @@
-print nested/sourcee3 \ No newline at end of file
diff --git a/tests/build/semantics/source/sourcee1 b/tests/build/semantics/source/sourcee1
deleted file mode 100644
index 683cd1f..0000000
--- a/tests/build/semantics/source/sourcee1
+++ /dev/null
@@ -1 +0,0 @@
-print sourcee1 \ No newline at end of file
diff --git a/tests/build/semantics/source/sourcee2 b/tests/build/semantics/source/sourcee2
deleted file mode 100644
index c989838..0000000
--- a/tests/build/semantics/source/sourcee2
+++ /dev/null
@@ -1 +0,0 @@
-print sourcee2
diff --git a/tests/build/semantics/source/sourcer b/tests/build/semantics/source/sourcer
deleted file mode 100644
index eb1310e..0000000
--- a/tests/build/semantics/source/sourcer
+++ /dev/null
@@ -1,9 +0,0 @@
-source
-source sourcee1
-source sourcee1 ../source/sourcee2
-nested/:
-{
- source sourcee3
- source ../sourcee1
-}
-:
diff --git a/tests/build/semantics/source/test.std b/tests/build/semantics/source/test.std
deleted file mode 100644
index 84d94b7..0000000
--- a/tests/build/semantics/source/test.std
+++ /dev/null
@@ -1,5 +0,0 @@
-sourcee1
-sourcee1
-sourcee2
-nested/sourcee3
-sourcee1