diff options
Diffstat (limited to 'tests')
175 files changed, 0 insertions, 2733 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index c7bd86c..e54525b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,6 +1 @@ driver -config.build - -# Temporary out-of-tree build directories. -# -*-out diff --git a/tests/amalgam/config/build/bootstrap.build b/tests/amalgam/config/build/bootstrap.build deleted file mode 100644 index 52d415a..0000000 --- a/tests/amalgam/config/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = amalgam-config -amalgamation = # Shall not be amalgamated. -using config diff --git a/tests/amalgam/config/build/root.build b/tests/amalgam/config/build/root.build deleted file mode 100644 index 7d1767b..0000000 --- a/tests/amalgam/config/build/root.build +++ /dev/null @@ -1 +0,0 @@ -using cxx diff --git a/tests/amalgam/config/buildfile b/tests/amalgam/config/buildfile deleted file mode 100644 index 32285a9..0000000 --- a/tests/amalgam/config/buildfile +++ /dev/null @@ -1,3 +0,0 @@ -d = #t/ l/ -./: $d -include $d diff --git a/tests/amalgam/libtest/build/bootstrap.build b/tests/amalgam/libtest/build/bootstrap.build deleted file mode 100644 index 025e510..0000000 --- a/tests/amalgam/libtest/build/bootstrap.build +++ /dev/null @@ -1,2 +0,0 @@ -project = amalgam-libtest -using config diff --git a/tests/amalgam/libtest/build/export.build b/tests/amalgam/libtest/build/export.build deleted file mode 100644 index b95e409..0000000 --- a/tests/amalgam/libtest/build/export.build +++ /dev/null @@ -1,6 +0,0 @@ -$out_root/: -{ - include buildfile -} - -export $out_root/lib{test} diff --git a/tests/amalgam/libtest/buildfile b/tests/amalgam/libtest/buildfile deleted file mode 100644 index 70a1467..0000000 --- a/tests/amalgam/libtest/buildfile +++ /dev/null @@ -1,3 +0,0 @@ -using cxx - -lib{test}: cxx{test} diff --git a/tests/amalgam/libtest/test.cxx b/tests/amalgam/libtest/test.cxx deleted file mode 100644 index 34a033a..0000000 --- a/tests/amalgam/libtest/test.cxx +++ /dev/null @@ -1,4 +0,0 @@ -void -f () -{ -} diff --git a/tests/amalgam/test/build/bootstrap.build b/tests/amalgam/test/build/bootstrap.build deleted file mode 100644 index a53e738..0000000 --- a/tests/amalgam/test/build/bootstrap.build +++ /dev/null @@ -1,2 +0,0 @@ -project = amalgam-test -using config diff --git a/tests/amalgam/test/buildfile b/tests/amalgam/test/buildfile deleted file mode 100644 index e8af169..0000000 --- a/tests/amalgam/test/buildfile +++ /dev/null @@ -1,5 +0,0 @@ -using cxx - -import libs = amalgam-libtest%lib{test} - -exe{driver}: cxx{driver} $libs diff --git a/tests/amalgam/test/driver.cxx b/tests/amalgam/test/driver.cxx deleted file mode 100644 index 70b4146..0000000 --- a/tests/amalgam/test/driver.cxx +++ /dev/null @@ -1,4 +0,0 @@ -int -main () -{ -} diff --git a/tests/amalgam/unnamed/build/bootstrap.build b/tests/amalgam/unnamed/build/bootstrap.build deleted file mode 100644 index 30065f4..0000000 --- a/tests/amalgam/unnamed/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = amalgam-unnamed -amalgamation = # Disabled. -using config diff --git a/tests/amalgam/unnamed/buildfile b/tests/amalgam/unnamed/buildfile deleted file mode 100644 index ead9514..0000000 --- a/tests/amalgam/unnamed/buildfile +++ /dev/null @@ -1,3 +0,0 @@ -./: sub/ -include sub/ -print $subprojects diff --git a/tests/amalgam/unnamed/sub/build/bootstrap.build b/tests/amalgam/unnamed/sub/build/bootstrap.build deleted file mode 100644 index ce3735a..0000000 --- a/tests/amalgam/unnamed/sub/build/bootstrap.build +++ /dev/null @@ -1,2 +0,0 @@ -project = -using config diff --git a/tests/amalgam/unnamed/sub/buildfile b/tests/amalgam/unnamed/sub/buildfile deleted file mode 100644 index 8717375..0000000 --- a/tests/amalgam/unnamed/sub/buildfile +++ /dev/null @@ -1,2 +0,0 @@ -./: -print "'$project'" diff --git a/tests/amalgam/unnamed/test.out b/tests/amalgam/unnamed/test.out deleted file mode 100644 index 023b71f..0000000 --- a/tests/amalgam/unnamed/test.out +++ /dev/null @@ -1,2 +0,0 @@ -'' -sub/@sub/ diff --git a/tests/amalgam/unnamed/test.sh b/tests/amalgam/unnamed/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/amalgam/unnamed/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/attribute/buildfile b/tests/attribute/buildfile deleted file mode 100644 index 6675894..0000000 --- a/tests/attribute/buildfile +++ /dev/null @@ -1,21 +0,0 @@ -#[] # error: standalone attribute sequence -#[foo] # error: standalone attribute sequence -#[[] # error: expected name instead of '[' -#[foo # error: expected ']' instead of <newline> -#[dir/file{foo}] # error: invalid attribute key -#[foo=dir/file{bar}] # error: invalid attribute key - -#[foo] print hello # error: attributes before print -#[foo]./: # error: attributes before directory scope -#{ -#} -#[foo]./: # error: attributes before target/scope -#./: [foo] buildfile # error: attributes before prerequisites -#import [foo] libz # error: attributes without variable - -#foo="F[O]O" -#[{x y z}] -#[$foo] -#["[]"] - -./: diff --git a/tests/cli/lib/libtest/build/bootstrap.build b/tests/cli/lib/libtest/build/bootstrap.build deleted file mode 100644 index 2e04406..0000000 --- a/tests/cli/lib/libtest/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = cli-lib-libtest -amalgamation = # Disabled. -using config diff --git a/tests/cli/lib/libtest/build/export.build b/tests/cli/lib/libtest/build/export.build deleted file mode 100644 index e8b12b3..0000000 --- a/tests/cli/lib/libtest/build/export.build +++ /dev/null @@ -1,6 +0,0 @@ -$out_root/: -{ - include test/ -} - -export $out_root/test/lib{test} diff --git a/tests/cli/lib/libtest/build/root.build b/tests/cli/lib/libtest/build/root.build deleted file mode 100644 index c9ff67d..0000000 --- a/tests/cli/lib/libtest/build/root.build +++ /dev/null @@ -1,5 +0,0 @@ -using cxx - -hxx{*}: extension = -ixx{*}: extension = ipp -cxx{*}: extension = cpp diff --git a/tests/cli/lib/libtest/buildfile b/tests/cli/lib/libtest/buildfile deleted file mode 100644 index 7ea849d..0000000 --- a/tests/cli/lib/libtest/buildfile +++ /dev/null @@ -1,2 +0,0 @@ -./: test/ -include test/ diff --git a/tests/cli/lib/libtest/test/base.cli b/tests/cli/lib/libtest/test/base.cli deleted file mode 100644 index bbf9999..0000000 --- a/tests/cli/lib/libtest/test/base.cli +++ /dev/null @@ -1,7 +0,0 @@ -namespace test -{ - class base - { - bool --version; - }; -} diff --git a/tests/cli/lib/libtest/test/buildfile b/tests/cli/lib/libtest/test/buildfile deleted file mode 100644 index 6b0d9bd..0000000 --- a/tests/cli/lib/libtest/test/buildfile +++ /dev/null @@ -1,20 +0,0 @@ -using cli - -lib{test}: cxx{utility} cli.cxx{test base} extra/cxx{test} -cli.cxx{test}: cli{test} -cli.cxx{base}: cli{base} - -cli.options += -I $src_root --include-with-brackets - -extra/: -{ - cxx{test} hxx{test}: cli{test} - cli.options += --include-prefix test/extra --guard-prefix TEST_EXTRA \ - --cli-namespace test::extra::cli -} - -cxx.poptions += -I$out_root -I$src_root -lib{test}: cxx.export.poptions = -I$out_root -I$src_root - -cli.options += --include-prefix test --guard-prefix TEST \ ---cli-namespace test::cli diff --git a/tests/cli/lib/libtest/test/extra/test.cli b/tests/cli/lib/libtest/test/extra/test.cli deleted file mode 100644 index 8408402..0000000 --- a/tests/cli/lib/libtest/test/extra/test.cli +++ /dev/null @@ -1,11 +0,0 @@ -namespace test -{ - namespace extra - { - class options - { - bool --help; - bool --version; - }; - } -} diff --git a/tests/cli/lib/libtest/test/test.cli b/tests/cli/lib/libtest/test/test.cli deleted file mode 100644 index f19d56c..0000000 --- a/tests/cli/lib/libtest/test/test.cli +++ /dev/null @@ -1,9 +0,0 @@ -include <test/base.cli>; - -namespace test -{ - class options: base - { - bool --help; - }; -} diff --git a/tests/cli/lib/libtest/test/utility.cpp b/tests/cli/lib/libtest/test/utility.cpp deleted file mode 100644 index 7c59218..0000000 --- a/tests/cli/lib/libtest/test/utility.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include <test/test> - -void -f () -{ -} diff --git a/tests/cli/lib/test/build/bootstrap.build b/tests/cli/lib/test/build/bootstrap.build deleted file mode 100644 index db43826..0000000 --- a/tests/cli/lib/test/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = cli-lib-test -amalgamation = # Disabled. -using config diff --git a/tests/cli/lib/test/build/root.build b/tests/cli/lib/test/build/root.build deleted file mode 100644 index 636fd02..0000000 --- a/tests/cli/lib/test/build/root.build +++ /dev/null @@ -1,7 +0,0 @@ -using cxx - -hxx{*}: extension = h -ixx{*}: extension = inl -cxx{*}: extension = C - -using cli diff --git a/tests/cli/lib/test/buildfile b/tests/cli/lib/test/buildfile deleted file mode 100644 index d3e784d..0000000 --- a/tests/cli/lib/test/buildfile +++ /dev/null @@ -1,6 +0,0 @@ -import libs += cli-lib-libtest%lib{test} - -exe{driver}: cxx{driver} cli.cxx{test} $libs -cli.cxx{test}: cli{test} - -cxx.poptions += -I$out_root diff --git a/tests/cli/lib/test/driver.C b/tests/cli/lib/test/driver.C deleted file mode 100644 index ee2171f..0000000 --- a/tests/cli/lib/test/driver.C +++ /dev/null @@ -1,8 +0,0 @@ -#include "test.h" -#include <test/test> -#include <test/extra/test> - -int -main () -{ -} diff --git a/tests/cli/lib/test/test.cli b/tests/cli/lib/test/test.cli deleted file mode 100644 index db3cfb8..0000000 --- a/tests/cli/lib/test/test.cli +++ /dev/null @@ -1,5 +0,0 @@ -class options -{ - bool --help; - bool --version; -}; diff --git a/tests/cli/simple/build/bootstrap.build b/tests/cli/simple/build/bootstrap.build deleted file mode 100644 index 2c116c9..0000000 --- a/tests/cli/simple/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = cli-simple -amalgamation = # Disabled. -using config diff --git a/tests/cli/simple/build/root.build b/tests/cli/simple/build/root.build deleted file mode 100644 index 8b13789..0000000 --- a/tests/cli/simple/build/root.build +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/cli/simple/buildfile b/tests/cli/simple/buildfile deleted file mode 100644 index 47e06d9..0000000 --- a/tests/cli/simple/buildfile +++ /dev/null @@ -1,15 +0,0 @@ -using cxx - -hxx{*}: extension = -cxx{*}: extension = cpp -ixx{*}: extension = ipp - -cxx.poptions += -I$out_root - -using cli - -exe{driver}: cxx{driver} cxx{test} -cxx{test} hxx{test}: cli{test} - -#exe{driver}: cxx{driver} cli.cxx{test} -#cli.cxx{test}: cli{test} diff --git a/tests/cli/simple/driver.cpp b/tests/cli/simple/driver.cpp deleted file mode 100644 index ef9cc60..0000000 --- a/tests/cli/simple/driver.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "test" - -int -main () -{ -} diff --git a/tests/cli/simple/test.cli b/tests/cli/simple/test.cli deleted file mode 100644 index db3cfb8..0000000 --- a/tests/cli/simple/test.cli +++ /dev/null @@ -1,5 +0,0 @@ -class options -{ - bool --help; - bool --version; -}; diff --git a/tests/define/buildfile b/tests/define/buildfile deleted file mode 100644 index d85fc57..0000000 --- a/tests/define/buildfile +++ /dev/null @@ -1,14 +0,0 @@ -#define # expected name -#define foo # expected : -#define foo: # expected name -#define foo: bar # unknown target type - -define foo: file -foo{FOO}: # verify name is foo{FOO} and not file{FOO} with --verbose 6 - -#define foo: dir # already define in this scope - -define bar: foo -bar{BAR}: # verify name is bar{BAR} with --verbose 6 - -./: diff --git a/tests/define/buildfile.alias b/tests/define/buildfile.alias deleted file mode 100644 index d3b9fc4..0000000 --- a/tests/define/buildfile.alias +++ /dev/null @@ -1,16 +0,0 @@ -#define # expected name -#define foo # expected = -#define foo= # expected name -#define foo=bar # unknown target type - -define foo=file -foo{FOO}: # verify name is foo{FOO} and not file{FOO} with --verbose 6 - -#define foo=dir # already define in this scope - -define bar=foo -bar{FOO}: # verify name is foo{FOO} and not bar{FOO} with --verbose 6 -bar{BAR}: # verify name is bar{BAR} - -define folder=dir -folder{./}: # verify prints "folder{} is up to date" diff --git a/tests/depdb/buildfile b/tests/depdb/buildfile deleted file mode 100644 index 53e9cd3..0000000 --- a/tests/depdb/buildfile +++ /dev/null @@ -1,8 +0,0 @@ -# file : tests/depdb/buildfile -# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -import libs = libbutl%lib{butl} - -exe{driver}: cxx{driver ../../build2/{depdb}} $libs -exe{driver}: test.arguments = $out_base/test.d diff --git a/tests/depdb/driver.cxx b/tests/depdb/driver.cxx deleted file mode 100644 index f156991..0000000 --- a/tests/depdb/driver.cxx +++ /dev/null @@ -1,166 +0,0 @@ -// file : tests/depdb/driver.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include <iostream> - -#include <butl/filesystem> - -#include <build2/types> -#include <build2/utility> - -#include <build2/depdb> - -using namespace std; -using namespace build2; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " <db-file>" << endl; - return 1; - } - - path p (argv[1]); - auto rm = [&p] () {try_rmfile (p);}; - - // Create empty database. - // - { - rm (); - - { - depdb d (p); - assert (d.writing ()); - d.close (); - } - - { - depdb d (p); - assert (d.reading ()); - assert (!d.more ()); - assert (d.read () == nullptr); - d.close (); - } - } - - // No close/end marker. - // - { - rm (); - - { - depdb d (p); - assert (d.writing ()); - // No close. - } - - { - depdb d (p); - assert (d.writing ()); - d.close (); - } - - { - depdb d (p); - assert (d.reading ()); - } - } - - // Overwrite/append/truncate. - // - { - rm (); - - { - depdb d (p); - d.write ("foo"); - d.close (); - } - - { - depdb d (p); - assert (*d.read () == "foo"); - assert (!d.more ()); - d.close (); - } - - { - depdb d (p); - assert (*d.read () == "foo"); - assert (!d.more ()); - d.write ("FOO"); - d.close (); - } - - { - depdb d (p); - assert (*d.read () == "FOO"); - assert (!d.more ()); - assert (d.read () == nullptr); - assert (d.read () == nullptr); - d.write ("BAR"); - d.close (); - } - - { - depdb d (p); - assert (*d.read () == "FOO"); - assert (d.more ()); - d.write ("foo"); - d.close (); // Truncate. - } - - { - depdb d (p); - assert (*d.read () == "foo"); - assert (!d.more ()); - } - - // Stray end marker. - // - { - depdb d (p); - assert (*d.read () == "foo"); - d.write ("fox"); - // No close. - } - - { - depdb d (p); - assert (d.more ()); - assert (*d.read () == "fox"); - assert (!d.more ()); - } - } - - // Read/truncate. - // - { - rm (); - - { - depdb d (p); - d.write ("foo"); - d.write ("bar"); - d.close (); - } - - { - depdb d (p); - assert (*d.read () == "foo"); - assert (d.more ()); - d.close (); // Truncate bar. - } - - { - depdb d (p); - assert (*d.read () == "foo"); - assert (!d.more ()); - } - } - - rm (); -} diff --git a/tests/dist/simple/README b/tests/dist/simple/README deleted file mode 100644 index e69de29..0000000 --- a/tests/dist/simple/README +++ /dev/null diff --git a/tests/dist/simple/bootstrap b/tests/dist/simple/bootstrap deleted file mode 100755 index e69de29..0000000 --- a/tests/dist/simple/bootstrap +++ /dev/null diff --git a/tests/dist/simple/build/bootstrap.build b/tests/dist/simple/build/bootstrap.build deleted file mode 100644 index 0cd9015..0000000 --- a/tests/dist/simple/build/bootstrap.build +++ /dev/null @@ -1,9 +0,0 @@ -project = dist-simple -version = 1.0.0 -amalgamation = # Disabled. -using config -using dist -using test -using install - -dist.package = $project-$version diff --git a/tests/dist/simple/build/export.build b/tests/dist/simple/build/export.build deleted file mode 100644 index e69de29..0000000 --- a/tests/dist/simple/build/export.build +++ /dev/null diff --git a/tests/dist/simple/buildfile b/tests/dist/simple/buildfile deleted file mode 100644 index 159fff3..0000000 --- a/tests/dist/simple/buildfile +++ /dev/null @@ -1,4 +0,0 @@ -using cxx - -exe{driver}: cxx{driver} doc{README} file{bootstrap} -exe{driver}: test.output = test.out diff --git a/tests/dist/simple/driver.cxx b/tests/dist/simple/driver.cxx deleted file mode 100644 index 293d7ff..0000000 --- a/tests/dist/simple/driver.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include <iostream> - -using namespace std; - -int -main () -{ - cerr << "test is running (stderr)" << endl; - cout << "test is running (stdout)" << endl; -} diff --git a/tests/dist/simple/test.out b/tests/dist/simple/test.out deleted file mode 100644 index 5d63fab..0000000 --- a/tests/dist/simple/test.out +++ /dev/null @@ -1 +0,0 @@ -test is running (stdout) diff --git a/tests/escaping/buildfile b/tests/escaping/buildfile deleted file mode 100644 index 4259087..0000000 --- a/tests/escaping/buildfile +++ /dev/null @@ -1,13 +0,0 @@ -print \'single\' -print \"double\" - -# Newline is special. -# -\ -print foo\ -bar - -print foo \ -bar - -./: diff --git a/tests/escaping/test.out b/tests/escaping/test.out deleted file mode 100644 index 9894dde..0000000 --- a/tests/escaping/test.out +++ /dev/null @@ -1,4 +0,0 @@ -'single' -"double" -foobar -foo bar diff --git a/tests/escaping/test.sh b/tests/escaping/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/escaping/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/eval/buildfile b/tests/eval/buildfile deleted file mode 100644 index f26a9a0..0000000 --- a/tests/eval/buildfile +++ /dev/null @@ -1,72 +0,0 @@ -(./): -() - -# Invalid. -# -#(foo -#(foo #comment - -print () -print ((foo)(bar)) -print ((foo) (bar)) - -print (foo\ -bar) - -# !=, == vs !, = recognition -# -print (=) -print (!) -print (= foo) -print (foo!) - -# !=, == evaluation -# - -# print ( == bar) -# print (foo == ) - -print (foo == bar) -print (foo == foo) -print (foo != bar) -print (foo != foo) - -print (foo == (foo)) -print ((foo bar) == foo bar) -print (foo != foo bar) -print ("" == '') - -print ((foo != bar) baz) -print "foo equals bar is (foo == bar)" - -foo = foo -print ($foo == foo) -print (bar != $foo) - -print ([null]) -print (([null])) -print ([uint64] 01) - -n = [null] -print ($n == [null]) -print ($N == [null]) -print ([null] == [null]) - -print ($n == $N == true) - -n = -print ($n == ) -n = {} -print ($n == "") - -#print ([uint64] 01 == [string] 01) - -# <, <=, >, >= evaluation -# -print (a < b) -print (a b > a a) -print (123 <= 123) -print ([uint64] 02 > [uint64] 01) -print (a > [null]) -print ([uint64] 02 > [null]) -print ($build.version > 30000) diff --git a/tests/eval/test.out b/tests/eval/test.out deleted file mode 100644 index 555853f..0000000 --- a/tests/eval/test.out +++ /dev/null @@ -1,36 +0,0 @@ - -foobar -foo bar -foobar -= -! -= foo -foo! -false -true -true -false -true -true -true -true -true baz -foo equals bar is false -true -true -[null] -[null] -1 -true -true -true -true -true -true -true -true -true -true -true -true -true diff --git a/tests/eval/test.sh b/tests/eval/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/eval/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/if-else/buildfile b/tests/if-else/buildfile deleted file mode 100644 index 25fabf0..0000000 --- a/tests/if-else/buildfile +++ /dev/null @@ -1,158 +0,0 @@ -#else # else without if -#elif # elif without if -#elif! # elif! without if -#if # expected if-expression -#if test # expected true or false -#if true # expected { -#x -#if true # expected newline after { -#{x -#if true # expected newline after } -#{ -#}x - -if true -{ - print 1 -} -else -{ - print 0 -} - -if! true -{ - print 0 -} -else -{ - print 1 -} - -if false -{ - print 0 -} -else -{ - print 1 -} - -if false -{ - print 0 -} -elif true -{ - print 1 -} -else -{ - print 0 -} - -if true -{ - print 1 -} -elif true -{ - print 0 -} -else -{ - print 0 -} - -# Empty block -# -if true -{ -} -else -{ - print 0 -} - -# Nested if-else -# -if true -{ - if true - { - print 1 - } -} -else -{ - if true - { - print 0 - } -} - -t = true -f = false - -if $t -{ - print 1 -} - -if! $f -{ - print 1 -} - -# With eval context. -# -if (foo == foo) -{ - print 1 -} - -if(foo != bar) -{ - print 1 -} - -if!(foo == bar) -{ - print 1 -} - -if ([uint64] 01 == [uint64] 1) -{ - print 1 -} - -# Single line. -# - -#if true -#} # expected if-line - -if true - print 1 - -if false - - print 0 -else - # Comment. - print 1 - -if true - if false - print 0 - else - print 1 - -# EOF test. -# -./: - -if true -{ - print 1 -} diff --git a/tests/if-else/test.out b/tests/if-else/test.out deleted file mode 100644 index 58501cb..0000000 --- a/tests/if-else/test.out +++ /dev/null @@ -1,16 +0,0 @@ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 diff --git a/tests/if-else/test.sh b/tests/if-else/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/if-else/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/import/installed/build/bootstrap.build b/tests/import/installed/build/bootstrap.build deleted file mode 100644 index 2af1e60..0000000 --- a/tests/import/installed/build/bootstrap.build +++ /dev/null @@ -1,4 +0,0 @@ -project = import-installed -amalgamation = # Disabled. -using config -using test diff --git a/tests/import/installed/buildfile b/tests/import/installed/buildfile deleted file mode 100644 index ae9d705..0000000 --- a/tests/import/installed/buildfile +++ /dev/null @@ -1,12 +0,0 @@ -using cxx - -import libs += zlib%lib{z} -import libs += libsqlite3%lib{sqlite3} -import libs += libpq%lib{pq} - -#lib{driver}: cxx{driver} $libs - -exe{driver}: cxx{driver} $libs -exe{driver}: test = true - - diff --git a/tests/import/installed/driver.cxx b/tests/import/installed/driver.cxx deleted file mode 100644 index 70b4146..0000000 --- a/tests/import/installed/driver.cxx +++ /dev/null @@ -1,4 +0,0 @@ -int -main () -{ -} diff --git a/tests/install/lib/libtest/build/bootstrap.build b/tests/install/lib/libtest/build/bootstrap.build deleted file mode 100644 index 0e83554..0000000 --- a/tests/install/lib/libtest/build/bootstrap.build +++ /dev/null @@ -1,5 +0,0 @@ -project = install-lib-libtest -amalgamation = # Disabled. -using config -using install -using test diff --git a/tests/install/lib/libtest/build/export.build b/tests/install/lib/libtest/build/export.build deleted file mode 100644 index e8b12b3..0000000 --- a/tests/install/lib/libtest/build/export.build +++ /dev/null @@ -1,6 +0,0 @@ -$out_root/: -{ - include test/ -} - -export $out_root/test/lib{test} diff --git a/tests/install/lib/libtest/build/root.build b/tests/install/lib/libtest/build/root.build deleted file mode 100644 index 20536a2..0000000 --- a/tests/install/lib/libtest/build/root.build +++ /dev/null @@ -1,11 +0,0 @@ -using cxx - -hxx{*}: extension = hxx -ixx{*}: extension = ixx -cxx{*}: extension = cxx - -tests/: -{ - exe{*}: test = true - install = false -} diff --git a/tests/install/lib/libtest/buildfile b/tests/install/lib/libtest/buildfile deleted file mode 100644 index 32dd3f2..0000000 --- a/tests/install/lib/libtest/buildfile +++ /dev/null @@ -1,3 +0,0 @@ -d = doc/ test/ tests/ -./: $d -include $d diff --git a/tests/install/lib/libtest/doc/buildfile b/tests/install/lib/libtest/doc/buildfile deleted file mode 100644 index dfc1701..0000000 --- a/tests/install/lib/libtest/doc/buildfile +++ /dev/null @@ -1 +0,0 @@ -./: doc{test.txt} man1{test} diff --git a/tests/install/lib/libtest/doc/test.1 b/tests/install/lib/libtest/doc/test.1 deleted file mode 100644 index 0a32f2b..0000000 --- a/tests/install/lib/libtest/doc/test.1 +++ /dev/null @@ -1,5 +0,0 @@ -.TH TEST 1 -.SH NAME -test \- this is a test -.SH SYNOPSIS -.B test-driver diff --git a/tests/install/lib/libtest/doc/test.txt b/tests/install/lib/libtest/doc/test.txt deleted file mode 100644 index 484ba93..0000000 --- a/tests/install/lib/libtest/doc/test.txt +++ /dev/null @@ -1 +0,0 @@ -This is a test. diff --git a/tests/install/lib/libtest/test/buildfile b/tests/install/lib/libtest/test/buildfile deleted file mode 100644 index 343bc30..0000000 --- a/tests/install/lib/libtest/test/buildfile +++ /dev/null @@ -1,10 +0,0 @@ -cxx.poptions += -I$src_root - -install.include = $install.include/test/ - -lib{test}: cxx{utility} hxx{utility} -lib{test}: cxx.export.poptions = -I$src_root - -exe{driver}: cxx{driver} hxx{driver} lib{test} - -./: lib{test} exe{driver} diff --git a/tests/install/lib/libtest/test/driver.cxx b/tests/install/lib/libtest/test/driver.cxx deleted file mode 100644 index fbb6643..0000000 --- a/tests/install/lib/libtest/test/driver.cxx +++ /dev/null @@ -1,4 +0,0 @@ -#include <test/utility.hxx> -#include "driver.hxx" - -int main () {return test::f ();} diff --git a/tests/install/lib/libtest/test/driver.hxx b/tests/install/lib/libtest/test/driver.hxx deleted file mode 100644 index e69de29..0000000 --- a/tests/install/lib/libtest/test/driver.hxx +++ /dev/null diff --git a/tests/install/lib/libtest/test/utility.cxx b/tests/install/lib/libtest/test/utility.cxx deleted file mode 100644 index 2016b45..0000000 --- a/tests/install/lib/libtest/test/utility.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include <test/utility.hxx> - -namespace test -{ - int f () {return 0;} -} diff --git a/tests/install/lib/libtest/test/utility.hxx b/tests/install/lib/libtest/test/utility.hxx deleted file mode 100644 index 1a9dd72..0000000 --- a/tests/install/lib/libtest/test/utility.hxx +++ /dev/null @@ -1,5 +0,0 @@ -namespace test -{ - int f (); -} - diff --git a/tests/install/lib/libtest/tests/buildfile b/tests/install/lib/libtest/tests/buildfile deleted file mode 100644 index 72d549a..0000000 --- a/tests/install/lib/libtest/tests/buildfile +++ /dev/null @@ -1,2 +0,0 @@ -exe{driver}: cxx{driver} ../test/lib{test} -include ../test/ diff --git a/tests/install/lib/libtest/tests/driver.cxx b/tests/install/lib/libtest/tests/driver.cxx deleted file mode 100644 index 9a12f9d..0000000 --- a/tests/install/lib/libtest/tests/driver.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include <test/utility.hxx> - -int main () {return test::f ();} diff --git a/tests/install/simple/README b/tests/install/simple/README deleted file mode 100644 index 484ba93..0000000 --- a/tests/install/simple/README +++ /dev/null @@ -1 +0,0 @@ -This is a test. diff --git a/tests/install/simple/build/bootstrap.build b/tests/install/simple/build/bootstrap.build deleted file mode 100644 index 40e665b..0000000 --- a/tests/install/simple/build/bootstrap.build +++ /dev/null @@ -1,4 +0,0 @@ -project = install-simple -amalgamation = # Disabled. -using config -using install diff --git a/tests/install/simple/buildfile b/tests/install/simple/buildfile deleted file mode 100644 index d37f63f..0000000 --- a/tests/install/simple/buildfile +++ /dev/null @@ -1,4 +0,0 @@ -using cxx - -exe{driver}: cxx{driver} hxx{utility} doc{README} -exe{driver}: install = sbin/ diff --git a/tests/install/simple/driver.cxx b/tests/install/simple/driver.cxx deleted file mode 100644 index 1b28c94..0000000 --- a/tests/install/simple/driver.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include "utility.hxx" - -int main () {return result;} diff --git a/tests/install/simple/utility.hxx b/tests/install/simple/utility.hxx deleted file mode 100644 index 1b8e18e..0000000 --- a/tests/install/simple/utility.hxx +++ /dev/null @@ -1,2 +0,0 @@ -const int result = 0; - diff --git a/tests/keyword/buildfile b/tests/keyword/buildfile deleted file mode 100644 index cd91d33..0000000 --- a/tests/keyword/buildfile +++ /dev/null @@ -1,23 +0,0 @@ -# Quoting. -# -"print" = a -'print' += b -pr"int" += c -print'' += d - -# Not = or +=. -# -print += e - -print $print - -# <name>( -# -print(test) - -# Separated. -# -define print: file -print{foo}: - -./: diff --git a/tests/keyword/test.out b/tests/keyword/test.out deleted file mode 100644 index 729af10..0000000 --- a/tests/keyword/test.out +++ /dev/null @@ -1,2 +0,0 @@ -a b c d e -test diff --git a/tests/keyword/test.sh b/tests/keyword/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/keyword/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/lexer/buildfile b/tests/lexer/buildfile deleted file mode 100644 index 9a17904..0000000 --- a/tests/lexer/buildfile +++ /dev/null @@ -1,7 +0,0 @@ -# file : tests/lexer/buildfile -# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -import libs = libbutl%lib{butl} - -exe{driver}: cxx{driver ../../build/{lexer diagnostics utility}} $libs diff --git a/tests/lexer/driver.cxx b/tests/lexer/driver.cxx deleted file mode 100644 index 5575956..0000000 --- a/tests/lexer/driver.cxx +++ /dev/null @@ -1,179 +0,0 @@ -// file : tests/build/lexer/driver.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 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; - -using tokens = vector<string>; - -static tokens -lex (const char*); - -ostream& -operator<< (ostream&, const tokens&); - -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 ({"foobar", ""})); - assert (lex ("foo \\\nbar") == tokens ({"foo", "bar", ""})); - assert (lex ("\\'foo") == tokens ({"'foo", ""})); - - assert (lex (" \\") == tokens ({"<lexer error>"})); - assert (lex (" foo\\") == tokens ({"<lexer error>"})); - - - // Quoting ''. - // - assert (lex ("''") == tokens ({"", ""})); - assert (lex ("'foo'") == tokens ({"foo", ""})); - assert (lex ("'foo bar'") == tokens ({"foo bar", ""})); - assert (lex ("'foo 'bar") == tokens ({"foo bar", ""})); - assert (lex ("foo' bar'") == tokens ({"foo bar", ""})); - assert (lex ("'foo ''bar'") == tokens ({"foo bar", ""})); - assert (lex ("foo' 'bar") == tokens ({"foo bar", ""})); - assert (lex ("'foo\nbar'") == tokens ({"foo\nbar", ""})); - assert (lex ("'#:${}()=+\n'") == tokens ({"#:${}()=+\n", ""})); - assert (lex ("'\"'") == tokens ({"\"", ""})); - assert (lex ("'\\'") == tokens ({"\\", ""})); - - assert (lex ("'foo bar") == tokens ({"<lexer error>"})); - - // Quoting "". - // - assert (lex ("\"\"") == tokens ({"", ""})); - assert (lex ("\"foo\"") == tokens ({"foo", ""})); - assert (lex ("\"foo bar\"") == tokens ({"foo bar", ""})); - assert (lex ("\"foo \"bar") == tokens ({"foo bar", ""})); - assert (lex ("foo\" bar\"") == tokens ({"foo bar", ""})); - assert (lex ("\"foo \"\"bar\"") == tokens ({"foo bar", ""})); - assert (lex ("foo\" \"bar") == tokens ({"foo bar", ""})); - assert (lex ("\"foo\nbar\"") == tokens ({"foo\nbar", ""})); - assert (lex ("\"#:{})=+\n\"") == tokens ({"#:{})=+\n", ""})); - assert (lex ("\"'\"") == tokens ({"'", ""})); - assert (lex ("\"\\\"") == tokens ({"\\", ""})); - - assert (lex ("\"$\"") == tokens ({"", "$", "", ""})); - assert (lex ("\"foo$bar\"") == tokens ({"foo", "$", "bar", ""})); - assert (lex ("foo\"$\"bar") == tokens ({"foo", "$", "bar", ""})); - assert (lex ("f\"oo$ba\"r") == tokens ({"foo", "$", "bar", ""})); - - assert (lex ("\"foo bar") == tokens ({"<lexer error>"})); - assert (lex ("\"foo $") == tokens ({"foo ", "$", "<lexer error>"})); - assert (lex ("\"foo $bar") == tokens ({"foo ", "$", "<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 ()) - { - string v; - - switch (t.type) - { - case token_type::eos: v = ""; break; - case token_type::newline: v = "\n"; break; - case token_type::pair_separator: v = l.pair_separator (); break; - case token_type::colon: v = ":"; break; - case token_type::lcbrace: v = "{"; break; - case token_type::rcbrace: v = "}"; break; - case token_type::equal: v = "="; break; - case token_type::plus_equal: v = "+="; break; - case token_type::dollar: v = "$"; break; - case token_type::lparen: v = "("; break; - case token_type::rparen: v = ")"; break; - case token_type::name: v = t.value.c_str (); break; - } - - // cerr << t.line () << ':' << t.column () << ':' << v << endl; - - r.push_back (move (v)); - - if (t.type == token_type::eos) - break; - } - } - catch (const failed&) - { - r.push_back ("<lexer error>"); - } - catch (const io_error&) - { - r.push_back ("<io error>"); - } - - return r; -} - -ostream& -operator<< (ostream& os, const tokens& ts) -{ - for (const string& t: ts) - os << '"' << t << '"' << ' '; - - return os; -} diff --git a/tests/names/buildfile b/tests/names/buildfile deleted file mode 100644 index 0f3d482..0000000 --- a/tests/names/buildfile +++ /dev/null @@ -1,54 +0,0 @@ -# Name separation. -# -print foo {bar baz} -print fox/ {bar baz} -print fox/foo {bar baz} - -# Name "crosses". -# -print {}{bar} # Same as bar. -print {foo}{} # Same as foo{} (empty name of type foo). -print foo{} # For compatiron. -print {foo}{bar} -print {foo}{bar baz} -print {foo fox}{bar} -print {foo fox}{bar baz} - -print dir/{}{bar} # Same as dir/bar. -print dir/{foo}{} # Same as dir/foo{} (directory of type foo). -print dir/foo{} # For comparison. -print dir/{foo}{bar} -print dir/{foo}{bar baz} -print dir/{foo fox}{bar} -print dir/{foo fox}{bar baz} - -print {dir/}{bar} -print {dir/}{bar baz} -print {dir/ dor/}{bar} -print {dir/ dor/}{bar baz} - -print {dir/foo}{bar} -print {dir/foo}{bar baz} -print {dir/foo dor/fox}{bar} -print {dir/foo dor/fox}{bar baz} - -print {dir/}{foo}{bar} -print {dir/}{foo}{bar baz} -print {dir/ dor/}{foo}{bar} -print {dir/ dor/}{foo fox}{bar baz} - -print {prj%foo}{bar baz} -print {foo}{bar prj%baz} -#print {prj%foo}{bar prk%baz} # nested project name - -print dir/{foo}{bar baz} -print {foo}{bar dir/{baz}} -print dir/{foo}{bar dor/{baz}} - -print {dir/foo{}}{bar} -print {dir/{foo}}{bar} -print {dir/}{foo{bar}} -#print {dir/foo{fox}}{bar} # nested type name -#print {dir/foo}{fox{bar}} # nested type name - -./: diff --git a/tests/names/test.out b/tests/names/test.out deleted file mode 100644 index 280c372..0000000 --- a/tests/names/test.out +++ /dev/null @@ -1,37 +0,0 @@ -foo bar baz -fox/ bar baz -fox/foo bar baz -bar -foo{} -foo{} -foo{bar} -foo{bar} foo{baz} -foo{bar} fox{bar} -foo{bar} fox{bar} foo{baz} fox{baz} -dir/bar -foo{dir/} -foo{dir/} -dir/foo{bar} -dir/foo{bar} dir/foo{baz} -dir/foo{bar} dir/fox{bar} -dir/foo{bar} dir/fox{bar} dir/foo{baz} dir/fox{baz} -dir/bar -dir/bar dir/baz -dir/bar dor/bar -dir/bar dor/bar dir/baz dor/baz -dir/foo{bar} -dir/foo{bar} dir/foo{baz} -dir/foo{bar} dor/fox{bar} -dir/foo{bar} dor/fox{bar} dir/foo{baz} dor/fox{baz} -dir/foo{bar} -dir/foo{bar} dir/foo{baz} -dir/foo{bar} dor/foo{bar} -dir/foo{bar} dor/foo{bar} dir/fox{bar} dor/fox{bar} dir/foo{baz} dor/foo{baz} dir/fox{baz} dor/fox{baz} -prj%foo{bar} prj%foo{baz} -foo{bar} prj%foo{baz} -dir/foo{bar} dir/foo{baz} -foo{bar} dir/foo{baz} -dir/foo{bar} dir/dor/foo{baz} -dir/foo{bar} -dir/foo{bar} -dir/foo{bar} diff --git a/tests/names/test.sh b/tests/names/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/names/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/pairs/buildfile b/tests/pairs/buildfile deleted file mode 100644 index 3b55044..0000000 --- a/tests/pairs/buildfile +++ /dev/null @@ -1,40 +0,0 @@ -print foo@bar # foo@bar -print foo@{bar} # foo@bar -print {foo}@bar # foo@bar -print {foo@bar} # foo@bar -print {{foo}@{bar}} # foo@bar -print "{foo}@bar" # {foo}@bar - -print foo@ # foo@{} -print {foo}@ # foo@{} -print {foo}@{} # foo@{} -print {foo}@ {FOO}@ # foo@{} FOO@{} -v=foo@ -print $v # foo@{} - -print @bar # {}@bar -print @{bar} # {}@bar -print {}@{bar} # {}@bar -print @{BAR} @{bar} # {}@BAR {}@bar -v=@bar -print $v # {}@bar - -print @ # {}@{} -print @{} # {}@{} -print {}@ # {}@{} -print {}@{} # {}@{} -print {@} # {}@{} -v=@ -print $v # {}@{} - -print @ @ # {}@{} {}@{} -v=@ @ -print $v # {}@{} {}@{} - -print @{bar BAR} # {}@bar {}@BAR -print @{bar {BAR}} # {}@bar {}@BAR -print foo@{bar BAR} # foo@bar foo@BAR - -#print @@ # error: double pair separator - -./: diff --git a/tests/pairs/test.out b/tests/pairs/test.out deleted file mode 100644 index 6033c84..0000000 --- a/tests/pairs/test.out +++ /dev/null @@ -1,27 +0,0 @@ -foo@bar -foo@bar -foo@bar -foo@bar -foo@bar -{foo}@bar -foo@{} -foo@{} -foo@{} -foo@{} FOO@{} -foo@{} -{}@bar -{}@bar -{}@bar -{}@BAR {}@bar -{}@bar -{}@{} -{}@{} -{}@{} -{}@{} -{}@{} -{}@{} -{}@{} {}@{} -{}@{} {}@{} -{}@bar {}@BAR -{}@bar {}@BAR -foo@bar foo@BAR diff --git a/tests/pairs/test.sh b/tests/pairs/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/pairs/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/parser/buildfile b/tests/parser/buildfile deleted file mode 100644 index ec158fa..0000000 --- a/tests/parser/buildfile +++ /dev/null @@ -1,9 +0,0 @@ -# file : tests/parser/buildfile -# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -import libs = libbutl%lib{butl} - -exe{driver}: cxx{driver ../../build/{token lexer parser scope target \ - prerequisite variable operation rule search algorithm file module dump \ - context diagnostics name path-io utility}} $libs diff --git a/tests/parser/driver.cxx b/tests/parser/driver.cxx deleted file mode 100644 index 7c73937..0000000 --- a/tests/parser/driver.cxx +++ /dev/null @@ -1,195 +0,0 @@ -// file : tests/build/parser/driver.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 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/context> -#include <build/variable> - -#include <build/lexer> -#include <build/parser> - -using namespace std; -using namespace build; - -static bool -parse (const char*); - -static names -parse_names (const char* s, lexer_mode m, bool chunk); - -static names -chunk_names (const char* s) -{ - return parse_names (s, lexer_mode::pairs, true); -} - -int -main () -{ - ostream cnull (nullptr); - diag_stream = &cnull; - - reset (); - - global_scope->assign ("foo") = "FOO"; - global_scope->assign ("bar") = "BAR"; - - // names() in chunking mode. - // - assert (chunk_names ("{}") == names ({name ()})); - assert (chunk_names ("foo") == names ({name ("foo")})); - assert (chunk_names ("foo bar") == names ({name ("foo")})); - assert (chunk_names ("{foo bar}") == names ({name ("foo"), name ("bar")})); - assert (chunk_names ("dir{foo bar}") == names ({name ("dir", "foo"), - name ("dir", "bar")})); - assert (chunk_names ("dir{foo bar} baz") == names ({name ("dir", "foo"), - name ("dir", "bar")})); - assert (chunk_names ("dir {foo bar}") == names ({name ("dir", "foo"), - name ("dir", "bar")})); - assert (chunk_names ("dir {foo bar} baz") == names ({name ("dir", "foo"), - name ("dir", "bar")})); - assert (chunk_names ("{} foo") == names ({name ()})); - - // Expansion. - // - assert (chunk_names ("$foo $bar baz") == names ({name ("FOO")})); - assert (chunk_names ("$foo$bar baz") == names ({name ("FOOBAR")})); - - assert (chunk_names ("foo(bar)") == names ({name ("foobar")})); - assert (chunk_names ("foo (bar)") == names ({name ("foo")})); - - assert (chunk_names ("\"$foo\"(bar)") == names ({name ("FOObar")})); - assert (chunk_names ("\"$foo\" (bar)") == names ({name ("FOO")})); - - // Quoting. - // - assert (chunk_names ("\"$foo $bar\" baz") == names ({name ("FOO BAR")})); - - // Pairs. - // - assert (chunk_names ("foo=bar") == names ({name ("foo"), name ("bar")})); - assert (chunk_names ("foo = bar x") == names ({name ("foo"), name ("bar")})); - - // General. - // - 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 ("file{foo}:")); - assert (parse ("file{foo bar}:")); - assert (parse ("{file{foo bar}}:")); - assert (parse ("file{{foo bar} fox}:")); - assert (parse ("file{foo}: file{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 ("file{foo:")); - - // Directory prefix. - // - assert (parse ("../{foo}: ../{bar}")); - assert (parse ("../file{foo}: ../file{bar}")); - assert (!parse ("../file{file{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}")); -} - -struct test_parser: parser -{ - names_type - test_names (const char*, lexer_mode, bool chunk); -}; - -static bool -parse (const char* s) -{ - reset (); // Clear the state. - - // Create a minimal root scope. - // - auto i (scopes.insert (path::current (), nullptr, true, true)); - scope& root (*i->second); - root.src_path_ = root.out_path_ = &i->first; - - istringstream is (s); - - is.exceptions (istream::failbit | istream::badbit); - parser p; - - try - { - p.parse_buildfile (is, path (), root, root); - } - catch (const failed&) - { - return false; - } - - return true; -} - -// parser::names() -// -names test_parser:: -test_names (const char* s, lexer_mode m, bool chunk) -{ - istringstream is (s); - is.exceptions (istream::failbit | istream::badbit); - lexer l (is, ""); - - if (m != lexer_mode::normal) - l.mode (m, '='); - - path_ = &l.name (); - lexer_ = &l; - target_ = nullptr; - scope_ = root_ = global_scope; - - token t (token_type::eos, false, 0, 0); - token_type tt; - next (t, tt); - return names (t, tt, chunk); -} - -static names -parse_names (const char* s, lexer_mode m, bool chunk) -{ - test_parser p; - return p.test_names (s, m, chunk); -} diff --git a/tests/postponed/build/bootstrap.build b/tests/postponed/build/bootstrap.build deleted file mode 100644 index 42ba33a..0000000 --- a/tests/postponed/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = postponed -amalgamation = # Disabled. -using config diff --git a/tests/postponed/buildfile b/tests/postponed/buildfile deleted file mode 100644 index 53873aa..0000000 --- a/tests/postponed/buildfile +++ /dev/null @@ -1,5 +0,0 @@ -using cxx - -exe{driver}: cxx{driver} fsdir{$out_root/out} - -./: exe{driver} diff --git a/tests/postponed/driver.cxx b/tests/postponed/driver.cxx deleted file mode 100644 index 70b4146..0000000 --- a/tests/postponed/driver.cxx +++ /dev/null @@ -1,4 +0,0 @@ -int -main () -{ -} diff --git a/tests/postponed/out/dummy b/tests/postponed/out/dummy deleted file mode 100644 index e69de29..0000000 --- a/tests/postponed/out/dummy +++ /dev/null diff --git a/tests/quote/buildfile b/tests/quote/buildfile deleted file mode 100644 index e8951b5..0000000 --- a/tests/quote/buildfile +++ /dev/null @@ -1,51 +0,0 @@ -print "foo bar" -print "foo -bar" - -foo = "fo o" -bar = " bar " - -print "$foo" -print "$bar" -print "$foo $bar" -print "$foo$bar" - -print "[ $foo ]" -print "[ $bar ]" -print "[ $foo $bar ]" -print "[ $foo/$bar ]" - -print $foo'bar' -print $foo"$bar" -print "$foo"bar - -# Quoting and evaluation context. -# -print ("x{foo bar}") -#print "(x{foo bar})" # multiple values in concatenating context expansion -print "({foo})" -print "('foo bar')" -print "("foo bar")" -print "("$foo bar")" -print "("$foo ($bar)")" - -# Quoting and escaping/multiline. -# -print \ -"foo"\ -"bar" - -print \ -"foo\ -bar" - -print \ -'foo\ -bar' - -print \ -"foo (fox \ -) -bar" - -./: diff --git a/tests/quote/test.out b/tests/quote/test.out deleted file mode 100644 index 33450a5..0000000 --- a/tests/quote/test.out +++ /dev/null @@ -1,26 +0,0 @@ -foo bar -foo -bar -fo o - bar -fo o bar -fo o bar -[ fo o ] -[ bar ] -[ fo o bar ] -[ fo o/ bar ] -fo obar -fo o bar -fo obar -x{foo bar} -foo -foo bar -foo bar -fo o bar -fo o bar -foobar -foobar -foo\ -bar -foo fox -bar diff --git a/tests/quote/test.sh b/tests/quote/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/quote/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/scope/amalgamation/build/bootstrap.build b/tests/scope/amalgamation/build/bootstrap.build deleted file mode 100644 index ee73365..0000000 --- a/tests/scope/amalgamation/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = scope-amalgamation -amalgamation = # Disabled. -using config diff --git a/tests/scope/amalgamation/buildfile b/tests/scope/amalgamation/buildfile deleted file mode 100644 index 9f80de9..0000000 --- a/tests/scope/amalgamation/buildfile +++ /dev/null @@ -1 +0,0 @@ -./: diff --git a/tests/scope/amalgamation/l1/build/bootstrap.build b/tests/scope/amalgamation/l1/build/bootstrap.build deleted file mode 100644 index 6bde838..0000000 --- a/tests/scope/amalgamation/l1/build/bootstrap.build +++ /dev/null @@ -1,16 +0,0 @@ -project = scope-amalgamation-l1 -using config - -# At this stage we don't know ../ is a project. This -# tests an out-of-project scope that will later be -# replaced with an in-project scope. Note that the -# replacement will only occur if src_root != out_root. -# If they are the same, then this scope will simply -# be "upgraded". -# -$src_root/../: -{ - print 0: $project - print 0: $src_base - print 0: $out_base -} diff --git a/tests/scope/amalgamation/l1/buildfile b/tests/scope/amalgamation/l1/buildfile deleted file mode 100644 index 55d8c64..0000000 --- a/tests/scope/amalgamation/l1/buildfile +++ /dev/null @@ -1,37 +0,0 @@ -# Out of amalgamation. -# -../../: -{ - print -1: $project - print -1: $src_base - print -1: $out_base -} - -# In amalgamation. -# -../s/: -{ - print 0: $project - print 0: $src_base - print 0: $out_base -} - -# In project. -# -s/: -{ - print 1: $project - print 1: $src_base - print 1: $out_base -} - -# In sub-project. -# -l2/s/: -{ - print 2: $project - print 2: $src_base - print 2: $out_base -} - -./: diff --git a/tests/scope/amalgamation/l1/l2/build/bootstrap.build b/tests/scope/amalgamation/l1/l2/build/bootstrap.build deleted file mode 100644 index 0262763..0000000 --- a/tests/scope/amalgamation/l1/l2/build/bootstrap.build +++ /dev/null @@ -1,2 +0,0 @@ -project = scope-amalgamation-l2 -using config diff --git a/tests/scope/test-1.out b/tests/scope/test-1.out deleted file mode 100644 index 0273bf1..0000000 --- a/tests/scope/test-1.out +++ /dev/null @@ -1,15 +0,0 @@ -0: -0: -0: --1: --1: --1: -0: scope-amalgamation -0: /home/boris/work/build2/build2/tests/scope/amalgamation/s/ -0: /home/boris/work/build2/build2/tests/scope/amalgamation/s/ -1: scope-amalgamation-l1 -1: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/s/ -1: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/s/ -2: scope-amalgamation-l2 -2: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/l2/s/ -2: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/l2/s/ diff --git a/tests/scope/test-2.out b/tests/scope/test-2.out deleted file mode 100644 index 88f9620..0000000 --- a/tests/scope/test-2.out +++ /dev/null @@ -1,15 +0,0 @@ -0: -0: -0: --1: --1: --1: -0: scope-amalgamation -0: /home/boris/work/build2/build2/tests/scope/amalgamation/s/ -0: /home/boris/work/build2/build2/tests/scope/a-out/s/ -1: scope-amalgamation-l1 -1: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/s/ -1: /home/boris/work/build2/build2/tests/scope/a-out/l1/s/ -2: scope-amalgamation-l2 -2: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/l2/s/ -2: /home/boris/work/build2/build2/tests/scope/a-out/l1/l2/s/ diff --git a/tests/scope/test.sh b/tests/scope/test.sh deleted file mode 100755 index 2728a9d..0000000 --- a/tests/scope/test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# In-tree. -# -b amalgamation/l1/ 2>/dev/null | diff --strip-trailing-cr -u test-1.out - - -# Out-of-tree. -# -rm -rf a-out/ -b 'configure(amalgamation/@a-out/)' 2>/dev/null - -b amalgamation/l1/@a-out/l1/ 2>/dev/null | \ - diff --strip-trailing-cr -u test-2.out - - -rm -rf a-out/ diff --git a/tests/semantics/include/buildfile b/tests/semantics/include/buildfile deleted file mode 120000 index 361dcf4..0000000 --- a/tests/semantics/include/buildfile +++ /dev/null @@ -1 +0,0 @@ -includer
\ No newline at end of file diff --git a/tests/semantics/include/includee1 b/tests/semantics/include/includee1 deleted file mode 100644 index 70ed3fc..0000000 --- a/tests/semantics/include/includee1 +++ /dev/null @@ -1 +0,0 @@ -print includee1
\ No newline at end of file diff --git a/tests/semantics/include/includee2 b/tests/semantics/include/includee2 deleted file mode 100644 index 762825b..0000000 --- a/tests/semantics/include/includee2 +++ /dev/null @@ -1 +0,0 @@ -print includee2 diff --git a/tests/semantics/include/includee4 b/tests/semantics/include/includee4 deleted file mode 100644 index 4964d81..0000000 --- a/tests/semantics/include/includee4 +++ /dev/null @@ -1 +0,0 @@ -print includee4 diff --git a/tests/semantics/include/includer b/tests/semantics/include/includer deleted file mode 100644 index 70527a5..0000000 --- a/tests/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/semantics/include/nested/includee3 b/tests/semantics/include/nested/includee3 deleted file mode 100644 index 7196e82..0000000 --- a/tests/semantics/include/nested/includee3 +++ /dev/null @@ -1,2 +0,0 @@ -print nested/includee3 -include ../includee4 diff --git a/tests/semantics/include/nested/includee5 b/tests/semantics/include/nested/includee5 deleted file mode 100644 index b4c9c74..0000000 --- a/tests/semantics/include/nested/includee5 +++ /dev/null @@ -1 +0,0 @@ -print nested/includee5 diff --git a/tests/semantics/include/test.std b/tests/semantics/include/test.std deleted file mode 100644 index 559584c..0000000 --- a/tests/semantics/include/test.std +++ /dev/null @@ -1,5 +0,0 @@ -includee1 -includee2 -nested/includee3 -includee4 -nested/includee5 diff --git a/tests/semantics/source/buildfile b/tests/semantics/source/buildfile deleted file mode 120000 index b6d1987..0000000 --- a/tests/semantics/source/buildfile +++ /dev/null @@ -1 +0,0 @@ -sourcer
\ No newline at end of file diff --git a/tests/semantics/source/nested/sourcee3 b/tests/semantics/source/nested/sourcee3 deleted file mode 100644 index cdf51fb..0000000 --- a/tests/semantics/source/nested/sourcee3 +++ /dev/null @@ -1 +0,0 @@ -print nested/sourcee3
\ No newline at end of file diff --git a/tests/semantics/source/sourcee1 b/tests/semantics/source/sourcee1 deleted file mode 100644 index 683cd1f..0000000 --- a/tests/semantics/source/sourcee1 +++ /dev/null @@ -1 +0,0 @@ -print sourcee1
\ No newline at end of file diff --git a/tests/semantics/source/sourcee2 b/tests/semantics/source/sourcee2 deleted file mode 100644 index c989838..0000000 --- a/tests/semantics/source/sourcee2 +++ /dev/null @@ -1 +0,0 @@ -print sourcee2 diff --git a/tests/semantics/source/sourcer b/tests/semantics/source/sourcer deleted file mode 100644 index eb1310e..0000000 --- a/tests/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/semantics/source/test.std b/tests/semantics/source/test.std deleted file mode 100644 index 84d94b7..0000000 --- a/tests/semantics/source/test.std +++ /dev/null @@ -1,5 +0,0 @@ -sourcee1 -sourcee1 -sourcee2 -nested/sourcee3 -sourcee1 diff --git a/tests/simple/build/bootstrap.build b/tests/simple/build/bootstrap.build deleted file mode 100644 index 7ee30cb..0000000 --- a/tests/simple/build/bootstrap.build +++ /dev/null @@ -1,3 +0,0 @@ -project = simple -amalgamation = # Disabled. -using config diff --git a/tests/simple/buildfile b/tests/simple/buildfile deleted file mode 100644 index ea1d8fa..0000000 --- a/tests/simple/buildfile +++ /dev/null @@ -1,3 +0,0 @@ -using cxx - -exe{driver}: cxx{driver} diff --git a/tests/simple/driver.cxx b/tests/simple/driver.cxx deleted file mode 100644 index 5b076c7..0000000 --- a/tests/simple/driver.cxx +++ /dev/null @@ -1,8 +0,0 @@ -#include <iostream> - -using namespace std; - -int -main () -{ -} diff --git a/tests/target/out-qualified/src/build/bootstrap.build b/tests/target/out-qualified/src/build/bootstrap.build deleted file mode 100644 index 056ee6f..0000000 --- a/tests/target/out-qualified/src/build/bootstrap.build +++ /dev/null @@ -1,2 +0,0 @@ -project = test -amalgamation = diff --git a/tests/target/out-qualified/src/buildfile b/tests/target/out-qualified/src/buildfile deleted file mode 100644 index 1bcaa32..0000000 --- a/tests/target/out-qualified/src/buildfile +++ /dev/null @@ -1,5 +0,0 @@ -./: file{foo} - -# Use --verbose 6 to debug. -# -file{foo}@./: x = y diff --git a/tests/target/out-qualified/src/foo b/tests/target/out-qualified/src/foo deleted file mode 100644 index e69de29..0000000 --- a/tests/target/out-qualified/src/foo +++ /dev/null diff --git a/tests/target/out-qualified/test.sh b/tests/target/out-qualified/test.sh deleted file mode 100755 index f1ece0e..0000000 --- a/tests/target/out-qualified/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q src/@out/ diff --git a/tests/test.sh b/tests/test.sh deleted file mode 100755 index de93322..0000000 --- a/tests/test.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env bash - -cur_dir="`pwd`" -trap 'cd "$cur_dir"' EXIT - -export PATH=$cur_dir/../build2:$PATH - -function test () -{ - echo "testing $1" - cd "$cur_dir/$1" - ./test.sh -} - -test "amalgam/unnamed" -test "escaping" -test "eval" -test "if-else" -test "keyword" -test "names" -test "pairs" -test "quote" -test "scope" -test "target/out-qualified" -test "variable/dir-path" -test "variable/expansion" -test "variable/null" -test "variable/override" -test "variable/prepend" -test "variable/qualified" -test "variable/representation" -test "variable/type" -test "variable/type-pattern-append" diff --git a/tests/test/generated/build/bootstrap.build b/tests/test/generated/build/bootstrap.build deleted file mode 100644 index 5428eb8..0000000 --- a/tests/test/generated/build/bootstrap.build +++ /dev/null @@ -1,4 +0,0 @@ -project = test-generated -amalgamation = # Disabled. -using config -using test diff --git a/tests/test/generated/buildfile b/tests/test/generated/buildfile deleted file mode 100644 index aacca8b..0000000 --- a/tests/test/generated/buildfile +++ /dev/null @@ -1,9 +0,0 @@ -# Test generated input. -# -using cxx - -exe{utility}: cxx{utility} -exe{driver}: cxx{driver} -exe{driver}: test.input = exe{utility} - -./: exe{driver} diff --git a/tests/test/generated/driver.cxx b/tests/test/generated/driver.cxx deleted file mode 100644 index 008dbf7..0000000 --- a/tests/test/generated/driver.cxx +++ /dev/null @@ -1,24 +0,0 @@ -#include <iostream> -#include <fstream> - -using namespace std; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " <file>" << endl; - return 1; - } - - ifstream ifs (argv[1], ifstream::in | ifstream::binary | ifstream::ate); - - if (!ifs.is_open ()) - cerr << "unable to open " << argv[1] << endl; - - if (ifs.tellg () == 0) - cerr << argv[1] << " is empty" << endl; - - return 0; -} diff --git a/tests/test/generated/utility.cxx b/tests/test/generated/utility.cxx deleted file mode 100644 index ca2ac4a..0000000 --- a/tests/test/generated/utility.cxx +++ /dev/null @@ -1 +0,0 @@ -int main () {} diff --git a/tests/test/simple/build/bootstrap.build b/tests/test/simple/build/bootstrap.build deleted file mode 100644 index 0b7a347..0000000 --- a/tests/test/simple/build/bootstrap.build +++ /dev/null @@ -1,4 +0,0 @@ -project = test-simple -amalgamation = # Disabled. -using config -using test diff --git a/tests/test/simple/buildfile b/tests/test/simple/buildfile deleted file mode 100644 index 569c12c..0000000 --- a/tests/test/simple/buildfile +++ /dev/null @@ -1,12 +0,0 @@ -using cxx - -lib{utility}: cxx{utility} -exe{driver}: cxx{driver} #lib{utility} - -#exe{driver}: test.roundtrip = test.out - -exe{*}: test = true -exe{*}: test.output = test.out - -./: lib{utility} exe{driver} -#./: exe{driver} diff --git a/tests/test/simple/driver.cxx b/tests/test/simple/driver.cxx deleted file mode 100644 index 3753821..0000000 --- a/tests/test/simple/driver.cxx +++ /dev/null @@ -1,14 +0,0 @@ -#include <iostream> -#include <cassert> - -using namespace std; - -int -main () -{ - cerr << "test is running (stderr)" << endl; - //assert (false); - cout << "test is running (stdout)" << endl; - return 0; - //return 1; -} diff --git a/tests/test/simple/test.out b/tests/test/simple/test.out deleted file mode 100644 index 5d63fab..0000000 --- a/tests/test/simple/test.out +++ /dev/null @@ -1 +0,0 @@ -test is running (stdout) diff --git a/tests/test/simple/utility.cxx b/tests/test/simple/utility.cxx deleted file mode 100644 index c4bb446..0000000 --- a/tests/test/simple/utility.cxx +++ /dev/null @@ -1 +0,0 @@ -void f (){} diff --git a/tests/using/buildfile b/tests/using/buildfile deleted file mode 100644 index 86baa42..0000000 --- a/tests/using/buildfile +++ /dev/null @@ -1,5 +0,0 @@ -using? foo -print $foo.loaded -print $foo.configured - -./: diff --git a/tests/variable/dir-path/buildfile b/tests/variable/dir-path/buildfile deleted file mode 100644 index 5c99f07..0000000 --- a/tests/variable/dir-path/buildfile +++ /dev/null @@ -1,45 +0,0 @@ -# Untyped dir path reversability. -# -x = s/foo/bar/ -print -e=$x -print -e $x - -y = $x -print -e=$y -print -e $y -print - -# Typed dir path reversability and expansion. -# -x = [dir_path] foo/bar/ -print -I$x -print -I$x/baz -print -I $x -print [strings] -I $x -print -I $x/baz -print - -y = $x # No longer typed but still not original. -print -I$y -print -I$y/baz -print -I $y -print [strings] -I $y -print -I $y/baz -print - -z = [strings] $x # Re-typed. -print $z -print - -# The root case. -# -r = [dir_path] / -print $r/foo - -r += foo -print [strings] $r - -r += bar -print [strings] $r - -./: diff --git a/tests/variable/dir-path/test.out b/tests/variable/dir-path/test.out deleted file mode 100644 index e608c42..0000000 --- a/tests/variable/dir-path/test.out +++ /dev/null @@ -1,22 +0,0 @@ --e=s/foo/bar/ --e s/foo/bar/ --e=s/foo/bar/ --e s/foo/bar/ - --Ifoo/bar --Ifoo/bar/baz --I foo/bar/ --I foo/bar --I foo/bar/baz - --Ifoo/bar --Ifoo/bar/baz --I foo/bar/ --I foo/bar --I foo/bar/baz - -foo/bar - -//foo -/foo -/foo/bar diff --git a/tests/variable/dir-path/test.sh b/tests/variable/dir-path/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/dir-path/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/expansion/buildfile b/tests/variable/expansion/buildfile deleted file mode 100644 index 3f28372..0000000 --- a/tests/variable/expansion/buildfile +++ /dev/null @@ -1,26 +0,0 @@ -foo = FOO - -print $foo -print $(foo) - -# Invalid. -# -#print $ -#print $() -#print $(foo bar) -#print $(foo{bar}) - -# Indirect. -# -FOO = foo -print $($FOO) -print $($(FOO)) -print $($($FOO)) - -# Quoted name. -# -"b a r" = BAR -print $("b a r") -#print $"b a r" - -./: diff --git a/tests/variable/expansion/test.out b/tests/variable/expansion/test.out deleted file mode 100644 index 5056f04..0000000 --- a/tests/variable/expansion/test.out +++ /dev/null @@ -1,6 +0,0 @@ -FOO -FOO -FOO -FOO -foo -BAR diff --git a/tests/variable/expansion/test.sh b/tests/variable/expansion/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/expansion/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/null/buildfile b/tests/variable/null/buildfile deleted file mode 100644 index 3fa1a9e..0000000 --- a/tests/variable/null/buildfile +++ /dev/null @@ -1,22 +0,0 @@ -#v = [null=junk] # error: unexpected value for attribute null: junk -#v = [null] junk # error: empty null value expected instead of 'junk' - -print $v0 # Undefined. - -v1 = [null] -print $v1 - -v2 = x -v2 = [null] -print $v2 - -v3a = [null] -v3b = $v3a -print $v3b -v3b = ($v3a) -print $v3b -print ($v3b) - -print [null] - -./: diff --git a/tests/variable/null/test.out b/tests/variable/null/test.out deleted file mode 100644 index 5119a71..0000000 --- a/tests/variable/null/test.out +++ /dev/null @@ -1,7 +0,0 @@ -[null] -[null] -[null] -[null] -[null] -[null] -[null] diff --git a/tests/variable/null/test.sh b/tests/variable/null/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/null/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/override/build/bootstrap.build b/tests/variable/override/build/bootstrap.build deleted file mode 100644 index 1c2e239..0000000 --- a/tests/variable/override/build/bootstrap.build +++ /dev/null @@ -1,2 +0,0 @@ -project = override -amalgamation = # Disabled. diff --git a/tests/variable/override/buildfile b/tests/variable/override/buildfile deleted file mode 100644 index c090e81..0000000 --- a/tests/variable/override/buildfile +++ /dev/null @@ -1,58 +0,0 @@ -if ($t != [null]) -{ - [$t] v = [null] -} - -print "/ :" $(/: v) - -if ($a == as) -{ - v = x -} -elif ($a == ap) -{ - v += s -} -elif ($a == pr) -{ - v =+ p -} - -print ". :" $v - -d/: -{ - if ($d_a == as) - { - v = x - } - elif ($d_a == ap) - { - v += s - } - elif ($d_a == pr) - { - v =+ p - } - - print "d :" $v - - - if ($d_t_a == as) - { - file{t}: v = x - } - elif ($d_t_a == ap) - { - file{t}: v += s - } - elif ($d_t_a == pr) - { - file{t}: v =+ p - } - - print "d/t :" $(file{t}: v) -} - -include p/ -./: diff --git a/tests/variable/override/cache b/tests/variable/override/cache deleted file mode 100644 index 8378688..0000000 --- a/tests/variable/override/cache +++ /dev/null @@ -1,13 +0,0 @@ -x = [string] 0 -print $x - -x = [uint64] 1 -print $x - -y = 0 -print $y - -[uint64] y = [null] -print $y - -./: diff --git a/tests/variable/override/p/build/bootstrap.build b/tests/variable/override/p/build/bootstrap.build deleted file mode 100644 index 723e2a3..0000000 --- a/tests/variable/override/p/build/bootstrap.build +++ /dev/null @@ -1 +0,0 @@ -project = override-p diff --git a/tests/variable/override/p/buildfile b/tests/variable/override/p/buildfile deleted file mode 100644 index 527b9ae..0000000 --- a/tests/variable/override/p/buildfile +++ /dev/null @@ -1,49 +0,0 @@ -if ($p_a == as) -{ - v = x -} -elif ($p_a == ap) -{ - v += s -} -elif ($p_a == pr) -{ - v =+ p -} - -print "p :" $v - -d/: -{ - if ($p_d_a == as) - { - v = x - } - elif ($p_d_a == ap) - { - v += s - } - elif ($p_d_a == pr) - { - v =+ p - } - - print "p/d :" $v - - if ($p_d_t_a == as) - { - file{t}: v = x - } - elif ($p_d_t_a == ap) - { - file{t}: v += s - } - elif ($p_d_t_a == pr) - { - file{t}: v =+ p - } - - print "p/d/t :" $(file{t}: v) -} - -./: diff --git a/tests/variable/override/p/loader b/tests/variable/override/p/loader deleted file mode 100644 index f298dcc..0000000 --- a/tests/variable/override/p/loader +++ /dev/null @@ -1 +0,0 @@ -include ../buildfile diff --git a/tests/variable/override/simple b/tests/variable/override/simple deleted file mode 100644 index 899daa2..0000000 --- a/tests/variable/override/simple +++ /dev/null @@ -1,3 +0,0 @@ -print $foo - -./: diff --git a/tests/variable/override/test.sh b/tests/variable/override/test.sh deleted file mode 100755 index a8b08b2..0000000 --- a/tests/variable/override/test.sh +++ /dev/null @@ -1,312 +0,0 @@ -#! /usr/bin/env bash - -verbose=n - -# By default when MSYS2 executable (bash.exe in particular) runs another -# executable it converts arguments that look like POSIX paths to Windows -# representations. More about it at: -# -# http://www.mingw.org/wiki/Posix_path_conversion -# -# So when you run b /v=X, build2 gets 'C:/msys64/v=X' argument instead of -# '/v=X'. To disable this behavior set MSYS2_ARG_CONV_EXCL environment -# variable, so all arguments starting with / will not be converted. You can -# list more prefixes using ';' as a separator. -# -export MSYS2_ARG_CONV_EXCL=/ - -tmp_file=`mktemp` - -# Remove temporary file on exit. Cover the case when exit due to an error. -# -trap 'rm -f $tmp_file' EXIT - -function error () { echo "$*" 1>&2; exit 1; } - -function fail () -{ - if [ "$verbose" = "y" ]; then - b $* - else - b -q $* 2>/dev/null - fi - - if [ $? -eq 0 ]; then - error "succeeded: b $*" - fi - - return 0 -} - -function test () -{ - b -q $* >$tmp_file - - if [ $? -ne 0 ]; then - error "failed: b -q $* >$tmp_file" - fi - - diff --strip-trailing-cr -u - $tmp_file - - if [ $? -ne 0 ]; then - error "failed: b $*" - fi -} - -fail foo=bar[] # error: unexpected [ in variable assignment 'foo=bar[]' -fail foo=[string]bar # error: typed override of variable foo -fail "!foo=bar" "!foo=BAR" # error: multiple global overrides of variable foo -fail "foo=bar" "foo=BAR" # error: multiple project overrides of variable foo -fail "%foo=bar" "%foo=BAR" # error: multiple project overrides of variable foo - -test --buildfile simple foo=bar ./ ./ <<< "bar" # Multiple bootstraps of the same project. - -# Visibility/qualification. -# -test !v=X <<EOF -/ : X -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test v=X <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test ./:v=X <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test ./p/:v=X <<EOF -/ : -. : -d : -d/t : -p : X -p/d : X -p/d/t : X -EOF - -test v=X --buildfile loader ./p/ <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test /v=X <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test v=X p_a=as <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test %v=X <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test %v=X p_a=as <<EOF -/ : -. : X -d : X -d/t : X -p : x -p/d : x -p/d/t : x -EOF - -test /v=X d_a=as p_d_a=as <<EOF -/ : -. : X -d : x -d/t : x -p : X -p/d : x -p/d/t : x -EOF - -test %v+=S %v=+P a=as <<EOF -/ : -. : P x S -d : P x S -d/t : P x S -p : P x S -p/d : P x S -p/d/t : P x S -EOF - -test %v+=S %v=+P a=as p_a=as <<EOF -/ : -. : P x S -d : P x S -d/t : P x S -p : x -p/d : x -p/d/t : x -EOF - -# Append/Prepend in override. -# -test v+=S <<EOF -/ : -. : S -d : S -d/t : S -p : S -p/d : S -p/d/t : S -EOF - -test v+=S a=as <<EOF -/ : -. : x S -d : x S -d/t : x S -p : x S -p/d : x S -p/d/t : x S -EOF - -test %v=+P a=as p_a=as <<EOF -/ : -. : P x -d : P x -d/t : P x -p : x -p/d : x -p/d/t : x -EOF - -test %v+=S v=+P a=as p_a=as <<EOF -/ : -. : P x S -d : P x S -d/t : P x S -p : P x -p/d : P x -p/d/t : P x -EOF - -# Append/Prepend in both. -# -test v=X a=ap d_a=ap p_a=ap p_d_a=ap <<EOF -/ : -. : X -d : X -d/t : X -p : X -p/d : X -p/d/t : X -EOF - -test v+=S v=+P a=as d_a=ap d_t_a=ap p_a=ap p_d_a=ap p_d_t_a=ap <<EOF -/ : -. : P x S -d : P x s S -d/t : P x s s S -p : P x s S -p/d : P x s s S -p/d/t : P x s s s S -EOF - -# These ones are surprising. I guess the moral is we shouldn't do "blind" -# cross-project append/prepend. -# -test %v=X a=as d_a=ap p_a=ap p_d_a=ap <<EOF -/ : -. : X -d : X -d/t : X -p : x s -p/d : x s s -p/d/t : x s s -EOF - -test %v+=S a=as d_a=ap p_a=ap p_d_a=ap <<EOF -/ : -. : x S -d : x s S -d/t : x s S -p : x s -p/d : x s s -p/d/t : x s s -EOF - -test %v+=S a=as d_a=ap p_a=ap p_d_a=ap ./ p/ <<EOF -/ : -. : x S -d : x s S -d/t : x s S -p : x s S -p/d : x s s S -p/d/t : x s s S -EOF - -# Typed override. -# -test v+=S v=+P t=string <<EOF -/ : -. : PS -d : PS -d/t : PS -p : PS -p/d : PS -p/d/t : PS -EOF - -test v+=S v=+P t=string a=as d_a=ap d_t_a=ap p_a=ap p_d_a=ap p_d_t_a=ap <<EOF -/ : -. : PxS -d : PxsS -d/t : PxssS -p : PxsS -p/d : PxssS -p/d/t : PxsssS -EOF - -# Cache overwrite. -# -test --buildfile cache x+=01 y+=01 <<EOF -001 -2 -0 01 -1 -EOF diff --git a/tests/variable/prepend/buildfile b/tests/variable/prepend/buildfile deleted file mode 100644 index 896f99d..0000000 --- a/tests/variable/prepend/buildfile +++ /dev/null @@ -1,14 +0,0 @@ -foo =+ FOO -print $foo - -foo =+ foo -print $foo - -foo = foo -print $foo - -foo =+ FOO -foo += FOO -print $foo - -./: diff --git a/tests/variable/prepend/test.out b/tests/variable/prepend/test.out deleted file mode 100644 index 80b77d0..0000000 --- a/tests/variable/prepend/test.out +++ /dev/null @@ -1,4 +0,0 @@ -FOO -foo FOO -foo -FOO foo FOO diff --git a/tests/variable/prepend/test.sh b/tests/variable/prepend/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/prepend/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/qualified/buildfile b/tests/variable/qualified/buildfile deleted file mode 100644 index 870b808..0000000 --- a/tests/variable/qualified/buildfile +++ /dev/null @@ -1,27 +0,0 @@ -#v = (foo:) # error: variable name expected before ':' -#v = (:bar) # error: scope/target expected after ':' - -print (foo:bar) -print (foo :bar) -print (foo: bar) -print (foo : bar) -print (foo/: bar) -print (foo/file{fox}: bar) - -bar=bar -sub/: -{ - bar=Bar - fsdir{./}: bar=BAR - file{x}: bar=BBAARR -} - -print $(./:bar) -print $(sub/:bar) -print $(fsdir{sub/}:bar) -print $(sub/file{x}:bar) - -print $(sub/file{y}:bar) -print $(sup/:bar) - -./: diff --git a/tests/variable/qualified/test.out b/tests/variable/qualified/test.out deleted file mode 100644 index 5bf062e..0000000 --- a/tests/variable/qualified/test.out +++ /dev/null @@ -1,12 +0,0 @@ -foo:bar -foo:bar -foo:bar -foo:bar -foo/:bar -foo/file{fox}:bar -bar -Bar -BAR -BBAARR -Bar -bar diff --git a/tests/variable/qualified/test.sh b/tests/variable/qualified/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/qualified/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/representation/build/bootstrap.build b/tests/variable/representation/build/bootstrap.build deleted file mode 100644 index 6a48e2e..0000000 --- a/tests/variable/representation/build/bootstrap.build +++ /dev/null @@ -1,4 +0,0 @@ -project = variable-representation -amalgamation = # Disabled. -using config -using test diff --git a/tests/variable/representation/buildfile b/tests/variable/representation/buildfile deleted file mode 100644 index b9c213d..0000000 --- a/tests/variable/representation/buildfile +++ /dev/null @@ -1,34 +0,0 @@ -# @@ I wonder if we can redo this test in terms of print? -# - -# Test reversibility of variable representation. -# -val = -L/ -val += -L/foo/ -val += .. -val += ../ -val += / -val += // -val += /// -val += //foo/ -#val += dir{-L/} - -# Note that this is "reversed" when we assign it to test.options -# since that variable is of type strings. -# -val += foo@bar foo/@bar/ foo@ @bar @ "@@" - -val += foo%bar -val += foo% -val += %bar -val += foo%{bar} -#val += foo%file{x} - -val += x%foo@y%bar -val += x%foo/@y%bar/ - -using cxx - -exe{driver}: cxx{driver} -exe{driver}: test.output = test.out -exe{driver}: test.options = $val diff --git a/tests/variable/representation/driver.cxx b/tests/variable/representation/driver.cxx deleted file mode 100644 index ecff9e2..0000000 --- a/tests/variable/representation/driver.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include <iostream> - -using namespace std; - -int -main (int argc, const char* argv[]) -{ - for (int i (1); i < argc; ++i) - cout << "'" << argv[i] << "'" << endl; -} diff --git a/tests/variable/representation/test.out b/tests/variable/representation/test.out deleted file mode 100644 index 84e7250..0000000 --- a/tests/variable/representation/test.out +++ /dev/null @@ -1,20 +0,0 @@ -'-L/' -'-L/foo/' -'..' -'../' -'/' -'//' -'///' -'//foo/' -'foo@bar' -'foo/@bar/' -'foo@' -'@bar' -'@' -'@@' -'foo%bar' -'foo%' -'%bar' -'foo%bar' -'x%foo@y%bar' -'x%foo/@y%bar/' diff --git a/tests/variable/representation/test.sh b/tests/variable/representation/test.sh deleted file mode 100755 index da9e0e9..0000000 --- a/tests/variable/representation/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -b test - diff --git a/tests/variable/type-pattern-append/buildfile b/tests/variable/type-pattern-append/buildfile deleted file mode 100644 index a91b340..0000000 --- a/tests/variable/type-pattern-append/buildfile +++ /dev/null @@ -1,59 +0,0 @@ -# Typed append/prepend. -# -#dir{a*}: x += [bool] true -#dir{p*}: x =+ [bool] true - -[string] typed = [null] -dir{a*}: typed += abc # ok -dir{p*}: typed =+ abc # ok - -# Prepend/append before/after assignment. -# -[string] x1 = [null] -dir{*}: x1 += A -dir{*}: x1 = b -dir{*}: x1 += c -dir{*}: x1 =+ a -print $(dir{./}:x1) - -# Without stem, mixed prepend/append. -# -dir{*}: x2 += b -dir{*}: x2 += c -#dir{*}: x2 =+ a # error -print $(dir{./}:x2) - -dir{*}: x3 =+ b -dir{*}: x3 =+ a -#dir{*}: x3 += c # error -print $(dir{./}:x3) - -# With stem, typing. -# -x4 = a -dir{*}: x4 += b -dir{*}: x4 += c -print $(dir{./}:x4) - -[string] x5 = b -dir{*}: x5 =+ a -x = $(dir{./}:x5) -print $(dir{./}:x5) - -x6 = [string] a -sub/: -{ - dir{*}: x6 += b - dir{*}: x6 += [null] - print $(dir{./}:x6) -} - -x7 = [string] b -dir{*}: x7 =+ a -sub/: -{ - dir{*}: x7 += c - print $(dir{./}:x7) -} - -./: diff --git a/tests/variable/type-pattern-append/test.out b/tests/variable/type-pattern-append/test.out deleted file mode 100644 index e8e2242..0000000 --- a/tests/variable/type-pattern-append/test.out +++ /dev/null @@ -1,7 +0,0 @@ -abc -b c -a b -a b c -ab -ab -abc diff --git a/tests/variable/type-pattern-append/test.sh b/tests/variable/type-pattern-append/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/type-pattern-append/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/type-pattern/buildfile b/tests/variable/type-pattern/buildfile deleted file mode 100644 index dd218ac..0000000 --- a/tests/variable/type-pattern/buildfile +++ /dev/null @@ -1,39 +0,0 @@ -#dir/foo{*}: x = y # directory -#foo{*.*}: x = y # multiple wildcards -#foo{*}: x = y # unknown target type -#file{*}: x += y # append - -# Use --verbose 6 to examine. -# - -dir{*}: x = y - -x = z -dir{*-foo}: x = $x # 'z' - -x = G -file{*-foo}: x = x -file{xfoo}: x = $x # 'G' -file{-foo}: x = $x # 'x' -file{x-foo}: x = $x # 'x' -file{bar-*-foo}: x = X -file{bar-x}: x = $x # 'G' -file{bar--foo}: x = $x # 'X' -file{bar-x-foo}: x = $x # 'X' - -file{*-fox}: x = 1 -file{fox-*}: x = 2 -file{fox-fox}: x = $x # '2' -file{*-fox}: x = 3 -file{fox-x-fox}: x = $x # still '2'! - -*-foz: x = z # any target -file{x-foz}: x = $x # 'z' - -# These should all be the same. -# -*: x1 = X1 -{*}: x2 = X2 -*{*}: x3 = X3 - -./: diff --git a/tests/variable/type/buildfile b/tests/variable/type/buildfile deleted file mode 100644 index a22cddd..0000000 --- a/tests/variable/type/buildfile +++ /dev/null @@ -1,84 +0,0 @@ -# Variable typing. -# - -#[string] str3 = foo -#[bool] str3 = false # error: changing str3 type from string to bool - -#[bool string] str3 = foo # error: multiple variable types: bool, string - -#[junk] jnk = foo # error: unknown variable attribute junk - -[string] str1 = bar -str1 =+ foo -str1 += baz -print $str1 - -str2 = bar -[string] str2 =+ foo -str2 += baz -print $str2 - -# Value typing. -# - -#v = [bool string] true # error: multiple value types: string, bool -#v = [string=junk] true # error: unexpected value for attribute string: junk - -#[string] var = -#var = [bool] true # error: confliction variable var type string and value type bool - -#var = [string] false -#var += [bool] true # error: confliction original value type string and append/prepend value type bool - -v1a = [uint64] 00 -v1b += [uint64] 00 -v1c =+ [uint64] 00 -print $v1a $v1b $v1c # 0 0 0 - -v2 = [uint64] 00 -v2 = [string] 00 -print $v2 # 00 - -#v3a = [uint64] 00 -#v3a += [string] 00 # error: confliction original value type uint64 and append/prepend value type string - -#v3b = [uint64] 00 -#v3b =+ [string] 00 # error: confliction original value type uint64 and append/prepend value type string - -v4a = 01 -v4a += [uint64] 01 -print $v4a # 2 - -v4b = 01 -v4b =+ [uint64] 01 -print $v4b # 2 - -v5a = 01 -sub/: -{ - v5a += [uint64] 01 - print $v5a # 2 -} - -v5b = 01 -sub/: -{ - v5b =+ [uint64] 01 - print $v5b # 2 -} - -v6 = [uint64 null] -v6 += 00 -print $v6 # 0 - -v7 = [string null] -v7 += [uint64] 00 -print $v7 # 0 - -print [uint64] 00 # 0 - -v8 = [uint64] 01 -v8 = abc -print $v8 # abc - -./: diff --git a/tests/variable/type/test.out b/tests/variable/type/test.out deleted file mode 100644 index 5218221..0000000 --- a/tests/variable/type/test.out +++ /dev/null @@ -1,12 +0,0 @@ -foobarbaz -foobarbaz -0 0 0 -00 -2 -2 -2 -2 -0 -0 -0 -abc diff --git a/tests/variable/type/test.sh b/tests/variable/type/test.sh deleted file mode 100755 index c745b76..0000000 --- a/tests/variable/type/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/version/buildfile b/tests/version/buildfile deleted file mode 100644 index eaf2f77..0000000 --- a/tests/version/buildfile +++ /dev/null @@ -1,31 +0,0 @@ -#using build@-1.0.0 -#using build@+1.0.0 -#using build@x.0.0 -#using build@1x.0.0 -#using build@1 -#using build@1. -#using build@1.x -#using build@1.1 -#using build@1.1. -#using build@1.1.x -#using build@1.1.100 -#using build@1.1.1~ -#using build@1.1.1-d -#using build@1.1.1-aX -#using build@1.1.1-a0 -#using build@1.1.1-a99 -#using build@1.1.1-a1X -#using build@0.0.0-a1 - -using build@0.0.0 -using build@0.0.1 -using build@0.0.1-a1 -using build@0.0.1-b2 - -#using build@0.1.0 -using build@0.1.0-a1 - -#using build@1.1.0 -#using build@1.1.0-b1 - -./: |