diff options
Diffstat (limited to 'old-tests')
175 files changed, 2734 insertions, 0 deletions
diff --git a/old-tests/.gitignore b/old-tests/.gitignore new file mode 100644 index 0000000..c7bd86c --- /dev/null +++ b/old-tests/.gitignore @@ -0,0 +1,6 @@ +driver +config.build + +# Temporary out-of-tree build directories. +# +*-out diff --git a/old-tests/amalgam/config/build/bootstrap.build b/old-tests/amalgam/config/build/bootstrap.build new file mode 100644 index 0000000..52d415a --- /dev/null +++ b/old-tests/amalgam/config/build/bootstrap.build @@ -0,0 +1,3 @@ +project = amalgam-config +amalgamation = # Shall not be amalgamated. +using config diff --git a/old-tests/amalgam/config/build/root.build b/old-tests/amalgam/config/build/root.build new file mode 100644 index 0000000..7d1767b --- /dev/null +++ b/old-tests/amalgam/config/build/root.build @@ -0,0 +1 @@ +using cxx diff --git a/old-tests/amalgam/config/buildfile b/old-tests/amalgam/config/buildfile new file mode 100644 index 0000000..32285a9 --- /dev/null +++ b/old-tests/amalgam/config/buildfile @@ -0,0 +1,3 @@ +d = #t/ l/ +./: $d +include $d diff --git a/old-tests/amalgam/libtest/build/bootstrap.build b/old-tests/amalgam/libtest/build/bootstrap.build new file mode 100644 index 0000000..025e510 --- /dev/null +++ b/old-tests/amalgam/libtest/build/bootstrap.build @@ -0,0 +1,2 @@ +project = amalgam-libtest +using config diff --git a/old-tests/amalgam/libtest/build/export.build b/old-tests/amalgam/libtest/build/export.build new file mode 100644 index 0000000..b95e409 --- /dev/null +++ b/old-tests/amalgam/libtest/build/export.build @@ -0,0 +1,6 @@ +$out_root/: +{ + include buildfile +} + +export $out_root/lib{test} diff --git a/old-tests/amalgam/libtest/buildfile b/old-tests/amalgam/libtest/buildfile new file mode 100644 index 0000000..70a1467 --- /dev/null +++ b/old-tests/amalgam/libtest/buildfile @@ -0,0 +1,3 @@ +using cxx + +lib{test}: cxx{test} diff --git a/old-tests/amalgam/libtest/test.cxx b/old-tests/amalgam/libtest/test.cxx new file mode 100644 index 0000000..34a033a --- /dev/null +++ b/old-tests/amalgam/libtest/test.cxx @@ -0,0 +1,4 @@ +void +f () +{ +} diff --git a/old-tests/amalgam/test/build/bootstrap.build b/old-tests/amalgam/test/build/bootstrap.build new file mode 100644 index 0000000..a53e738 --- /dev/null +++ b/old-tests/amalgam/test/build/bootstrap.build @@ -0,0 +1,2 @@ +project = amalgam-test +using config diff --git a/old-tests/amalgam/test/buildfile b/old-tests/amalgam/test/buildfile new file mode 100644 index 0000000..e8af169 --- /dev/null +++ b/old-tests/amalgam/test/buildfile @@ -0,0 +1,5 @@ +using cxx + +import libs = amalgam-libtest%lib{test} + +exe{driver}: cxx{driver} $libs diff --git a/old-tests/amalgam/test/driver.cxx b/old-tests/amalgam/test/driver.cxx new file mode 100644 index 0000000..70b4146 --- /dev/null +++ b/old-tests/amalgam/test/driver.cxx @@ -0,0 +1,4 @@ +int +main () +{ +} diff --git a/old-tests/amalgam/unnamed/build/bootstrap.build b/old-tests/amalgam/unnamed/build/bootstrap.build new file mode 100644 index 0000000..30065f4 --- /dev/null +++ b/old-tests/amalgam/unnamed/build/bootstrap.build @@ -0,0 +1,3 @@ +project = amalgam-unnamed +amalgamation = # Disabled. +using config diff --git a/old-tests/amalgam/unnamed/buildfile b/old-tests/amalgam/unnamed/buildfile new file mode 100644 index 0000000..ead9514 --- /dev/null +++ b/old-tests/amalgam/unnamed/buildfile @@ -0,0 +1,3 @@ +./: sub/ +include sub/ +print $subprojects diff --git a/old-tests/amalgam/unnamed/sub/build/bootstrap.build b/old-tests/amalgam/unnamed/sub/build/bootstrap.build new file mode 100644 index 0000000..ce3735a --- /dev/null +++ b/old-tests/amalgam/unnamed/sub/build/bootstrap.build @@ -0,0 +1,2 @@ +project = +using config diff --git a/old-tests/amalgam/unnamed/sub/buildfile b/old-tests/amalgam/unnamed/sub/buildfile new file mode 100644 index 0000000..8717375 --- /dev/null +++ b/old-tests/amalgam/unnamed/sub/buildfile @@ -0,0 +1,2 @@ +./: +print "'$project'" diff --git a/old-tests/amalgam/unnamed/test.out b/old-tests/amalgam/unnamed/test.out new file mode 100644 index 0000000..023b71f --- /dev/null +++ b/old-tests/amalgam/unnamed/test.out @@ -0,0 +1,2 @@ +'' +sub/@sub/ diff --git a/old-tests/amalgam/unnamed/test.sh b/old-tests/amalgam/unnamed/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/amalgam/unnamed/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/attribute/buildfile b/old-tests/attribute/buildfile new file mode 100644 index 0000000..6675894 --- /dev/null +++ b/old-tests/attribute/buildfile @@ -0,0 +1,21 @@ +#[] # 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/old-tests/cli/lib/libtest/build/bootstrap.build b/old-tests/cli/lib/libtest/build/bootstrap.build new file mode 100644 index 0000000..2e04406 --- /dev/null +++ b/old-tests/cli/lib/libtest/build/bootstrap.build @@ -0,0 +1,3 @@ +project = cli-lib-libtest +amalgamation = # Disabled. +using config diff --git a/old-tests/cli/lib/libtest/build/export.build b/old-tests/cli/lib/libtest/build/export.build new file mode 100644 index 0000000..e8b12b3 --- /dev/null +++ b/old-tests/cli/lib/libtest/build/export.build @@ -0,0 +1,6 @@ +$out_root/: +{ + include test/ +} + +export $out_root/test/lib{test} diff --git a/old-tests/cli/lib/libtest/build/root.build b/old-tests/cli/lib/libtest/build/root.build new file mode 100644 index 0000000..c9ff67d --- /dev/null +++ b/old-tests/cli/lib/libtest/build/root.build @@ -0,0 +1,5 @@ +using cxx + +hxx{*}: extension = +ixx{*}: extension = ipp +cxx{*}: extension = cpp diff --git a/old-tests/cli/lib/libtest/buildfile b/old-tests/cli/lib/libtest/buildfile new file mode 100644 index 0000000..7ea849d --- /dev/null +++ b/old-tests/cli/lib/libtest/buildfile @@ -0,0 +1,2 @@ +./: test/ +include test/ diff --git a/old-tests/cli/lib/libtest/test/base.cli b/old-tests/cli/lib/libtest/test/base.cli new file mode 100644 index 0000000..bbf9999 --- /dev/null +++ b/old-tests/cli/lib/libtest/test/base.cli @@ -0,0 +1,7 @@ +namespace test +{ + class base + { + bool --version; + }; +} diff --git a/old-tests/cli/lib/libtest/test/buildfile b/old-tests/cli/lib/libtest/test/buildfile new file mode 100644 index 0000000..6b0d9bd --- /dev/null +++ b/old-tests/cli/lib/libtest/test/buildfile @@ -0,0 +1,20 @@ +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/old-tests/cli/lib/libtest/test/extra/test.cli b/old-tests/cli/lib/libtest/test/extra/test.cli new file mode 100644 index 0000000..8408402 --- /dev/null +++ b/old-tests/cli/lib/libtest/test/extra/test.cli @@ -0,0 +1,11 @@ +namespace test +{ + namespace extra + { + class options + { + bool --help; + bool --version; + }; + } +} diff --git a/old-tests/cli/lib/libtest/test/test.cli b/old-tests/cli/lib/libtest/test/test.cli new file mode 100644 index 0000000..f19d56c --- /dev/null +++ b/old-tests/cli/lib/libtest/test/test.cli @@ -0,0 +1,9 @@ +include <test/base.cli>; + +namespace test +{ + class options: base + { + bool --help; + }; +} diff --git a/old-tests/cli/lib/libtest/test/utility.cpp b/old-tests/cli/lib/libtest/test/utility.cpp new file mode 100644 index 0000000..7c59218 --- /dev/null +++ b/old-tests/cli/lib/libtest/test/utility.cpp @@ -0,0 +1,6 @@ +#include <test/test> + +void +f () +{ +} diff --git a/old-tests/cli/lib/test/build/bootstrap.build b/old-tests/cli/lib/test/build/bootstrap.build new file mode 100644 index 0000000..db43826 --- /dev/null +++ b/old-tests/cli/lib/test/build/bootstrap.build @@ -0,0 +1,3 @@ +project = cli-lib-test +amalgamation = # Disabled. +using config diff --git a/old-tests/cli/lib/test/build/root.build b/old-tests/cli/lib/test/build/root.build new file mode 100644 index 0000000..636fd02 --- /dev/null +++ b/old-tests/cli/lib/test/build/root.build @@ -0,0 +1,7 @@ +using cxx + +hxx{*}: extension = h +ixx{*}: extension = inl +cxx{*}: extension = C + +using cli diff --git a/old-tests/cli/lib/test/buildfile b/old-tests/cli/lib/test/buildfile new file mode 100644 index 0000000..d3e784d --- /dev/null +++ b/old-tests/cli/lib/test/buildfile @@ -0,0 +1,6 @@ +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/old-tests/cli/lib/test/driver.C b/old-tests/cli/lib/test/driver.C new file mode 100644 index 0000000..ee2171f --- /dev/null +++ b/old-tests/cli/lib/test/driver.C @@ -0,0 +1,8 @@ +#include "test.h" +#include <test/test> +#include <test/extra/test> + +int +main () +{ +} diff --git a/old-tests/cli/lib/test/test.cli b/old-tests/cli/lib/test/test.cli new file mode 100644 index 0000000..db3cfb8 --- /dev/null +++ b/old-tests/cli/lib/test/test.cli @@ -0,0 +1,5 @@ +class options +{ + bool --help; + bool --version; +}; diff --git a/old-tests/cli/simple/build/bootstrap.build b/old-tests/cli/simple/build/bootstrap.build new file mode 100644 index 0000000..2c116c9 --- /dev/null +++ b/old-tests/cli/simple/build/bootstrap.build @@ -0,0 +1,3 @@ +project = cli-simple +amalgamation = # Disabled. +using config diff --git a/old-tests/cli/simple/build/root.build b/old-tests/cli/simple/build/root.build new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/old-tests/cli/simple/build/root.build @@ -0,0 +1 @@ + diff --git a/old-tests/cli/simple/buildfile b/old-tests/cli/simple/buildfile new file mode 100644 index 0000000..47e06d9 --- /dev/null +++ b/old-tests/cli/simple/buildfile @@ -0,0 +1,15 @@ +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/old-tests/cli/simple/driver.cpp b/old-tests/cli/simple/driver.cpp new file mode 100644 index 0000000..ef9cc60 --- /dev/null +++ b/old-tests/cli/simple/driver.cpp @@ -0,0 +1,6 @@ +#include "test" + +int +main () +{ +} diff --git a/old-tests/cli/simple/test.cli b/old-tests/cli/simple/test.cli new file mode 100644 index 0000000..db3cfb8 --- /dev/null +++ b/old-tests/cli/simple/test.cli @@ -0,0 +1,5 @@ +class options +{ + bool --help; + bool --version; +}; diff --git a/old-tests/define/buildfile b/old-tests/define/buildfile new file mode 100644 index 0000000..d85fc57 --- /dev/null +++ b/old-tests/define/buildfile @@ -0,0 +1,14 @@ +#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/old-tests/define/buildfile.alias b/old-tests/define/buildfile.alias new file mode 100644 index 0000000..d3b9fc4 --- /dev/null +++ b/old-tests/define/buildfile.alias @@ -0,0 +1,16 @@ +#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/old-tests/depdb/buildfile b/old-tests/depdb/buildfile new file mode 100644 index 0000000..53e9cd3 --- /dev/null +++ b/old-tests/depdb/buildfile @@ -0,0 +1,8 @@ +# 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/old-tests/depdb/driver.cxx b/old-tests/depdb/driver.cxx new file mode 100644 index 0000000..f156991 --- /dev/null +++ b/old-tests/depdb/driver.cxx @@ -0,0 +1,166 @@ +// 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/old-tests/dist/simple/README b/old-tests/dist/simple/README new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/old-tests/dist/simple/README diff --git a/old-tests/dist/simple/bootstrap b/old-tests/dist/simple/bootstrap new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/old-tests/dist/simple/bootstrap diff --git a/old-tests/dist/simple/build/bootstrap.build b/old-tests/dist/simple/build/bootstrap.build new file mode 100644 index 0000000..0cd9015 --- /dev/null +++ b/old-tests/dist/simple/build/bootstrap.build @@ -0,0 +1,9 @@ +project = dist-simple +version = 1.0.0 +amalgamation = # Disabled. +using config +using dist +using test +using install + +dist.package = $project-$version diff --git a/old-tests/dist/simple/build/export.build b/old-tests/dist/simple/build/export.build new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/old-tests/dist/simple/build/export.build diff --git a/old-tests/dist/simple/buildfile b/old-tests/dist/simple/buildfile new file mode 100644 index 0000000..159fff3 --- /dev/null +++ b/old-tests/dist/simple/buildfile @@ -0,0 +1,4 @@ +using cxx + +exe{driver}: cxx{driver} doc{README} file{bootstrap} +exe{driver}: test.output = test.out diff --git a/old-tests/dist/simple/driver.cxx b/old-tests/dist/simple/driver.cxx new file mode 100644 index 0000000..293d7ff --- /dev/null +++ b/old-tests/dist/simple/driver.cxx @@ -0,0 +1,10 @@ +#include <iostream> + +using namespace std; + +int +main () +{ + cerr << "test is running (stderr)" << endl; + cout << "test is running (stdout)" << endl; +} diff --git a/old-tests/dist/simple/test.out b/old-tests/dist/simple/test.out new file mode 100644 index 0000000..5d63fab --- /dev/null +++ b/old-tests/dist/simple/test.out @@ -0,0 +1 @@ +test is running (stdout) diff --git a/old-tests/escaping/buildfile b/old-tests/escaping/buildfile new file mode 100644 index 0000000..4259087 --- /dev/null +++ b/old-tests/escaping/buildfile @@ -0,0 +1,13 @@ +print \'single\' +print \"double\" + +# Newline is special. +# +\ +print foo\ +bar + +print foo \ +bar + +./: diff --git a/old-tests/escaping/test.out b/old-tests/escaping/test.out new file mode 100644 index 0000000..9894dde --- /dev/null +++ b/old-tests/escaping/test.out @@ -0,0 +1,4 @@ +'single' +"double" +foobar +foo bar diff --git a/old-tests/escaping/test.sh b/old-tests/escaping/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/escaping/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/eval/buildfile b/old-tests/eval/buildfile new file mode 100644 index 0000000..f26a9a0 --- /dev/null +++ b/old-tests/eval/buildfile @@ -0,0 +1,72 @@ +(./): +() + +# 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/old-tests/eval/test.out b/old-tests/eval/test.out new file mode 100644 index 0000000..555853f --- /dev/null +++ b/old-tests/eval/test.out @@ -0,0 +1,36 @@ + +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/old-tests/eval/test.sh b/old-tests/eval/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/eval/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/if-else/buildfile b/old-tests/if-else/buildfile new file mode 100644 index 0000000..25fabf0 --- /dev/null +++ b/old-tests/if-else/buildfile @@ -0,0 +1,158 @@ +#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/old-tests/if-else/test.out b/old-tests/if-else/test.out new file mode 100644 index 0000000..58501cb --- /dev/null +++ b/old-tests/if-else/test.out @@ -0,0 +1,16 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/old-tests/if-else/test.sh b/old-tests/if-else/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/if-else/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/import/installed/build/bootstrap.build b/old-tests/import/installed/build/bootstrap.build new file mode 100644 index 0000000..2af1e60 --- /dev/null +++ b/old-tests/import/installed/build/bootstrap.build @@ -0,0 +1,4 @@ +project = import-installed +amalgamation = # Disabled. +using config +using test diff --git a/old-tests/import/installed/buildfile b/old-tests/import/installed/buildfile new file mode 100644 index 0000000..ae9d705 --- /dev/null +++ b/old-tests/import/installed/buildfile @@ -0,0 +1,12 @@ +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/old-tests/import/installed/driver.cxx b/old-tests/import/installed/driver.cxx new file mode 100644 index 0000000..70b4146 --- /dev/null +++ b/old-tests/import/installed/driver.cxx @@ -0,0 +1,4 @@ +int +main () +{ +} diff --git a/old-tests/install/lib/libtest/build/bootstrap.build b/old-tests/install/lib/libtest/build/bootstrap.build new file mode 100644 index 0000000..0e83554 --- /dev/null +++ b/old-tests/install/lib/libtest/build/bootstrap.build @@ -0,0 +1,5 @@ +project = install-lib-libtest +amalgamation = # Disabled. +using config +using install +using test diff --git a/old-tests/install/lib/libtest/build/export.build b/old-tests/install/lib/libtest/build/export.build new file mode 100644 index 0000000..e8b12b3 --- /dev/null +++ b/old-tests/install/lib/libtest/build/export.build @@ -0,0 +1,6 @@ +$out_root/: +{ + include test/ +} + +export $out_root/test/lib{test} diff --git a/old-tests/install/lib/libtest/build/root.build b/old-tests/install/lib/libtest/build/root.build new file mode 100644 index 0000000..20536a2 --- /dev/null +++ b/old-tests/install/lib/libtest/build/root.build @@ -0,0 +1,11 @@ +using cxx + +hxx{*}: extension = hxx +ixx{*}: extension = ixx +cxx{*}: extension = cxx + +tests/: +{ + exe{*}: test = true + install = false +} diff --git a/old-tests/install/lib/libtest/buildfile b/old-tests/install/lib/libtest/buildfile new file mode 100644 index 0000000..32dd3f2 --- /dev/null +++ b/old-tests/install/lib/libtest/buildfile @@ -0,0 +1,3 @@ +d = doc/ test/ tests/ +./: $d +include $d diff --git a/old-tests/install/lib/libtest/doc/buildfile b/old-tests/install/lib/libtest/doc/buildfile new file mode 100644 index 0000000..dfc1701 --- /dev/null +++ b/old-tests/install/lib/libtest/doc/buildfile @@ -0,0 +1 @@ +./: doc{test.txt} man1{test} diff --git a/old-tests/install/lib/libtest/doc/test.1 b/old-tests/install/lib/libtest/doc/test.1 new file mode 100644 index 0000000..0a32f2b --- /dev/null +++ b/old-tests/install/lib/libtest/doc/test.1 @@ -0,0 +1,5 @@ +.TH TEST 1 +.SH NAME +test \- this is a test +.SH SYNOPSIS +.B test-driver diff --git a/old-tests/install/lib/libtest/doc/test.txt b/old-tests/install/lib/libtest/doc/test.txt new file mode 100644 index 0000000..484ba93 --- /dev/null +++ b/old-tests/install/lib/libtest/doc/test.txt @@ -0,0 +1 @@ +This is a test. diff --git a/old-tests/install/lib/libtest/test/buildfile b/old-tests/install/lib/libtest/test/buildfile new file mode 100644 index 0000000..343bc30 --- /dev/null +++ b/old-tests/install/lib/libtest/test/buildfile @@ -0,0 +1,10 @@ +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/old-tests/install/lib/libtest/test/driver.cxx b/old-tests/install/lib/libtest/test/driver.cxx new file mode 100644 index 0000000..fbb6643 --- /dev/null +++ b/old-tests/install/lib/libtest/test/driver.cxx @@ -0,0 +1,4 @@ +#include <test/utility.hxx> +#include "driver.hxx" + +int main () {return test::f ();} diff --git a/old-tests/install/lib/libtest/test/driver.hxx b/old-tests/install/lib/libtest/test/driver.hxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/old-tests/install/lib/libtest/test/driver.hxx diff --git a/old-tests/install/lib/libtest/test/utility.cxx b/old-tests/install/lib/libtest/test/utility.cxx new file mode 100644 index 0000000..2016b45 --- /dev/null +++ b/old-tests/install/lib/libtest/test/utility.cxx @@ -0,0 +1,6 @@ +#include <test/utility.hxx> + +namespace test +{ + int f () {return 0;} +} diff --git a/old-tests/install/lib/libtest/test/utility.hxx b/old-tests/install/lib/libtest/test/utility.hxx new file mode 100644 index 0000000..1a9dd72 --- /dev/null +++ b/old-tests/install/lib/libtest/test/utility.hxx @@ -0,0 +1,5 @@ +namespace test +{ + int f (); +} + diff --git a/old-tests/install/lib/libtest/tests/buildfile b/old-tests/install/lib/libtest/tests/buildfile new file mode 100644 index 0000000..72d549a --- /dev/null +++ b/old-tests/install/lib/libtest/tests/buildfile @@ -0,0 +1,2 @@ +exe{driver}: cxx{driver} ../test/lib{test} +include ../test/ diff --git a/old-tests/install/lib/libtest/tests/driver.cxx b/old-tests/install/lib/libtest/tests/driver.cxx new file mode 100644 index 0000000..9a12f9d --- /dev/null +++ b/old-tests/install/lib/libtest/tests/driver.cxx @@ -0,0 +1,3 @@ +#include <test/utility.hxx> + +int main () {return test::f ();} diff --git a/old-tests/install/simple/README b/old-tests/install/simple/README new file mode 100644 index 0000000..484ba93 --- /dev/null +++ b/old-tests/install/simple/README @@ -0,0 +1 @@ +This is a test. diff --git a/old-tests/install/simple/build/bootstrap.build b/old-tests/install/simple/build/bootstrap.build new file mode 100644 index 0000000..40e665b --- /dev/null +++ b/old-tests/install/simple/build/bootstrap.build @@ -0,0 +1,4 @@ +project = install-simple +amalgamation = # Disabled. +using config +using install diff --git a/old-tests/install/simple/buildfile b/old-tests/install/simple/buildfile new file mode 100644 index 0000000..d37f63f --- /dev/null +++ b/old-tests/install/simple/buildfile @@ -0,0 +1,4 @@ +using cxx + +exe{driver}: cxx{driver} hxx{utility} doc{README} +exe{driver}: install = sbin/ diff --git a/old-tests/install/simple/driver.cxx b/old-tests/install/simple/driver.cxx new file mode 100644 index 0000000..1b28c94 --- /dev/null +++ b/old-tests/install/simple/driver.cxx @@ -0,0 +1,3 @@ +#include "utility.hxx" + +int main () {return result;} diff --git a/old-tests/install/simple/utility.hxx b/old-tests/install/simple/utility.hxx new file mode 100644 index 0000000..1b8e18e --- /dev/null +++ b/old-tests/install/simple/utility.hxx @@ -0,0 +1,2 @@ +const int result = 0; + diff --git a/old-tests/keyword/buildfile b/old-tests/keyword/buildfile new file mode 100644 index 0000000..cd91d33 --- /dev/null +++ b/old-tests/keyword/buildfile @@ -0,0 +1,23 @@ +# 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/old-tests/keyword/test.out b/old-tests/keyword/test.out new file mode 100644 index 0000000..729af10 --- /dev/null +++ b/old-tests/keyword/test.out @@ -0,0 +1,2 @@ +a b c d e +test diff --git a/old-tests/keyword/test.sh b/old-tests/keyword/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/keyword/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/lexer/buildfile b/old-tests/lexer/buildfile new file mode 100644 index 0000000..9a17904 --- /dev/null +++ b/old-tests/lexer/buildfile @@ -0,0 +1,7 @@ +# 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/old-tests/lexer/driver.cxx b/old-tests/lexer/driver.cxx new file mode 100644 index 0000000..5575956 --- /dev/null +++ b/old-tests/lexer/driver.cxx @@ -0,0 +1,179 @@ +// 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/old-tests/names/buildfile b/old-tests/names/buildfile new file mode 100644 index 0000000..0f3d482 --- /dev/null +++ b/old-tests/names/buildfile @@ -0,0 +1,54 @@ +# 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/old-tests/names/test.out b/old-tests/names/test.out new file mode 100644 index 0000000..280c372 --- /dev/null +++ b/old-tests/names/test.out @@ -0,0 +1,37 @@ +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/old-tests/names/test.sh b/old-tests/names/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/names/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/pairs/buildfile b/old-tests/pairs/buildfile new file mode 100644 index 0000000..3b55044 --- /dev/null +++ b/old-tests/pairs/buildfile @@ -0,0 +1,40 @@ +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/old-tests/pairs/test.out b/old-tests/pairs/test.out new file mode 100644 index 0000000..6033c84 --- /dev/null +++ b/old-tests/pairs/test.out @@ -0,0 +1,27 @@ +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/old-tests/pairs/test.sh b/old-tests/pairs/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/pairs/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/parser/buildfile b/old-tests/parser/buildfile new file mode 100644 index 0000000..ec158fa --- /dev/null +++ b/old-tests/parser/buildfile @@ -0,0 +1,9 @@ +# 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/old-tests/parser/driver.cxx b/old-tests/parser/driver.cxx new file mode 100644 index 0000000..7c73937 --- /dev/null +++ b/old-tests/parser/driver.cxx @@ -0,0 +1,195 @@ +// 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/old-tests/postponed/build/bootstrap.build b/old-tests/postponed/build/bootstrap.build new file mode 100644 index 0000000..42ba33a --- /dev/null +++ b/old-tests/postponed/build/bootstrap.build @@ -0,0 +1,3 @@ +project = postponed +amalgamation = # Disabled. +using config diff --git a/old-tests/postponed/buildfile b/old-tests/postponed/buildfile new file mode 100644 index 0000000..53873aa --- /dev/null +++ b/old-tests/postponed/buildfile @@ -0,0 +1,5 @@ +using cxx + +exe{driver}: cxx{driver} fsdir{$out_root/out} + +./: exe{driver} diff --git a/old-tests/postponed/driver.cxx b/old-tests/postponed/driver.cxx new file mode 100644 index 0000000..70b4146 --- /dev/null +++ b/old-tests/postponed/driver.cxx @@ -0,0 +1,4 @@ +int +main () +{ +} diff --git a/old-tests/postponed/out/dummy b/old-tests/postponed/out/dummy new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/old-tests/postponed/out/dummy diff --git a/old-tests/quote/buildfile b/old-tests/quote/buildfile new file mode 100644 index 0000000..e8951b5 --- /dev/null +++ b/old-tests/quote/buildfile @@ -0,0 +1,51 @@ +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/old-tests/quote/test.out b/old-tests/quote/test.out new file mode 100644 index 0000000..33450a5 --- /dev/null +++ b/old-tests/quote/test.out @@ -0,0 +1,26 @@ +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/old-tests/quote/test.sh b/old-tests/quote/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/quote/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/scope/amalgamation/build/bootstrap.build b/old-tests/scope/amalgamation/build/bootstrap.build new file mode 100644 index 0000000..ee73365 --- /dev/null +++ b/old-tests/scope/amalgamation/build/bootstrap.build @@ -0,0 +1,3 @@ +project = scope-amalgamation +amalgamation = # Disabled. +using config diff --git a/old-tests/scope/amalgamation/buildfile b/old-tests/scope/amalgamation/buildfile new file mode 100644 index 0000000..9f80de9 --- /dev/null +++ b/old-tests/scope/amalgamation/buildfile @@ -0,0 +1 @@ +./: diff --git a/old-tests/scope/amalgamation/l1/build/bootstrap.build b/old-tests/scope/amalgamation/l1/build/bootstrap.build new file mode 100644 index 0000000..6bde838 --- /dev/null +++ b/old-tests/scope/amalgamation/l1/build/bootstrap.build @@ -0,0 +1,16 @@ +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/old-tests/scope/amalgamation/l1/buildfile b/old-tests/scope/amalgamation/l1/buildfile new file mode 100644 index 0000000..55d8c64 --- /dev/null +++ b/old-tests/scope/amalgamation/l1/buildfile @@ -0,0 +1,37 @@ +# 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/old-tests/scope/amalgamation/l1/l2/build/bootstrap.build b/old-tests/scope/amalgamation/l1/l2/build/bootstrap.build new file mode 100644 index 0000000..0262763 --- /dev/null +++ b/old-tests/scope/amalgamation/l1/l2/build/bootstrap.build @@ -0,0 +1,2 @@ +project = scope-amalgamation-l2 +using config diff --git a/old-tests/scope/test-1.out b/old-tests/scope/test-1.out new file mode 100644 index 0000000..0273bf1 --- /dev/null +++ b/old-tests/scope/test-1.out @@ -0,0 +1,15 @@ +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/old-tests/scope/test-2.out b/old-tests/scope/test-2.out new file mode 100644 index 0000000..88f9620 --- /dev/null +++ b/old-tests/scope/test-2.out @@ -0,0 +1,15 @@ +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/old-tests/scope/test.sh b/old-tests/scope/test.sh new file mode 100755 index 0000000..2728a9d --- /dev/null +++ b/old-tests/scope/test.sh @@ -0,0 +1,15 @@ +#!/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/old-tests/semantics/include/buildfile b/old-tests/semantics/include/buildfile new file mode 120000 index 0000000..361dcf4 --- /dev/null +++ b/old-tests/semantics/include/buildfile @@ -0,0 +1 @@ +includer
\ No newline at end of file diff --git a/old-tests/semantics/include/includee1 b/old-tests/semantics/include/includee1 new file mode 100644 index 0000000..70ed3fc --- /dev/null +++ b/old-tests/semantics/include/includee1 @@ -0,0 +1 @@ +print includee1
\ No newline at end of file diff --git a/old-tests/semantics/include/includee2 b/old-tests/semantics/include/includee2 new file mode 100644 index 0000000..762825b --- /dev/null +++ b/old-tests/semantics/include/includee2 @@ -0,0 +1 @@ +print includee2 diff --git a/old-tests/semantics/include/includee4 b/old-tests/semantics/include/includee4 new file mode 100644 index 0000000..4964d81 --- /dev/null +++ b/old-tests/semantics/include/includee4 @@ -0,0 +1 @@ +print includee4 diff --git a/old-tests/semantics/include/includer b/old-tests/semantics/include/includer new file mode 100644 index 0000000..70527a5 --- /dev/null +++ b/old-tests/semantics/include/includer @@ -0,0 +1,10 @@ +include +include includee1 +include includee1 ../include/includee2 # includee1 is skipped +include nested/includee3 +nested/: +{ + include includee5 + include ../includee2 # skipped +} +: diff --git a/old-tests/semantics/include/nested/includee3 b/old-tests/semantics/include/nested/includee3 new file mode 100644 index 0000000..7196e82 --- /dev/null +++ b/old-tests/semantics/include/nested/includee3 @@ -0,0 +1,2 @@ +print nested/includee3 +include ../includee4 diff --git a/old-tests/semantics/include/nested/includee5 b/old-tests/semantics/include/nested/includee5 new file mode 100644 index 0000000..b4c9c74 --- /dev/null +++ b/old-tests/semantics/include/nested/includee5 @@ -0,0 +1 @@ +print nested/includee5 diff --git a/old-tests/semantics/include/test.std b/old-tests/semantics/include/test.std new file mode 100644 index 0000000..559584c --- /dev/null +++ b/old-tests/semantics/include/test.std @@ -0,0 +1,5 @@ +includee1 +includee2 +nested/includee3 +includee4 +nested/includee5 diff --git a/old-tests/semantics/source/buildfile b/old-tests/semantics/source/buildfile new file mode 120000 index 0000000..b6d1987 --- /dev/null +++ b/old-tests/semantics/source/buildfile @@ -0,0 +1 @@ +sourcer
\ No newline at end of file diff --git a/old-tests/semantics/source/nested/sourcee3 b/old-tests/semantics/source/nested/sourcee3 new file mode 100644 index 0000000..cdf51fb --- /dev/null +++ b/old-tests/semantics/source/nested/sourcee3 @@ -0,0 +1 @@ +print nested/sourcee3
\ No newline at end of file diff --git a/old-tests/semantics/source/sourcee1 b/old-tests/semantics/source/sourcee1 new file mode 100644 index 0000000..683cd1f --- /dev/null +++ b/old-tests/semantics/source/sourcee1 @@ -0,0 +1 @@ +print sourcee1
\ No newline at end of file diff --git a/old-tests/semantics/source/sourcee2 b/old-tests/semantics/source/sourcee2 new file mode 100644 index 0000000..c989838 --- /dev/null +++ b/old-tests/semantics/source/sourcee2 @@ -0,0 +1 @@ +print sourcee2 diff --git a/old-tests/semantics/source/sourcer b/old-tests/semantics/source/sourcer new file mode 100644 index 0000000..eb1310e --- /dev/null +++ b/old-tests/semantics/source/sourcer @@ -0,0 +1,9 @@ +source +source sourcee1 +source sourcee1 ../source/sourcee2 +nested/: +{ + source sourcee3 + source ../sourcee1 +} +: diff --git a/old-tests/semantics/source/test.std b/old-tests/semantics/source/test.std new file mode 100644 index 0000000..84d94b7 --- /dev/null +++ b/old-tests/semantics/source/test.std @@ -0,0 +1,5 @@ +sourcee1 +sourcee1 +sourcee2 +nested/sourcee3 +sourcee1 diff --git a/old-tests/simple/build/bootstrap.build b/old-tests/simple/build/bootstrap.build new file mode 100644 index 0000000..7ee30cb --- /dev/null +++ b/old-tests/simple/build/bootstrap.build @@ -0,0 +1,3 @@ +project = simple +amalgamation = # Disabled. +using config diff --git a/old-tests/simple/buildfile b/old-tests/simple/buildfile new file mode 100644 index 0000000..ea1d8fa --- /dev/null +++ b/old-tests/simple/buildfile @@ -0,0 +1,3 @@ +using cxx + +exe{driver}: cxx{driver} diff --git a/old-tests/simple/driver.cxx b/old-tests/simple/driver.cxx new file mode 100644 index 0000000..5b076c7 --- /dev/null +++ b/old-tests/simple/driver.cxx @@ -0,0 +1,8 @@ +#include <iostream> + +using namespace std; + +int +main () +{ +} diff --git a/old-tests/target/out-qualified/src/build/bootstrap.build b/old-tests/target/out-qualified/src/build/bootstrap.build new file mode 100644 index 0000000..056ee6f --- /dev/null +++ b/old-tests/target/out-qualified/src/build/bootstrap.build @@ -0,0 +1,2 @@ +project = test +amalgamation = diff --git a/old-tests/target/out-qualified/src/buildfile b/old-tests/target/out-qualified/src/buildfile new file mode 100644 index 0000000..1bcaa32 --- /dev/null +++ b/old-tests/target/out-qualified/src/buildfile @@ -0,0 +1,5 @@ +./: file{foo} + +# Use --verbose 6 to debug. +# +file{foo}@./: x = y diff --git a/old-tests/target/out-qualified/src/foo b/old-tests/target/out-qualified/src/foo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/old-tests/target/out-qualified/src/foo diff --git a/old-tests/target/out-qualified/test.sh b/old-tests/target/out-qualified/test.sh new file mode 100755 index 0000000..f1ece0e --- /dev/null +++ b/old-tests/target/out-qualified/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q src/@out/ diff --git a/old-tests/test.sh b/old-tests/test.sh new file mode 100755 index 0000000..de93322 --- /dev/null +++ b/old-tests/test.sh @@ -0,0 +1,33 @@ +#! /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/old-tests/test/generated/build/bootstrap.build b/old-tests/test/generated/build/bootstrap.build new file mode 100644 index 0000000..5428eb8 --- /dev/null +++ b/old-tests/test/generated/build/bootstrap.build @@ -0,0 +1,4 @@ +project = test-generated +amalgamation = # Disabled. +using config +using test diff --git a/old-tests/test/generated/buildfile b/old-tests/test/generated/buildfile new file mode 100644 index 0000000..aacca8b --- /dev/null +++ b/old-tests/test/generated/buildfile @@ -0,0 +1,9 @@ +# Test generated input. +# +using cxx + +exe{utility}: cxx{utility} +exe{driver}: cxx{driver} +exe{driver}: test.input = exe{utility} + +./: exe{driver} diff --git a/old-tests/test/generated/driver.cxx b/old-tests/test/generated/driver.cxx new file mode 100644 index 0000000..008dbf7 --- /dev/null +++ b/old-tests/test/generated/driver.cxx @@ -0,0 +1,24 @@ +#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/old-tests/test/generated/utility.cxx b/old-tests/test/generated/utility.cxx new file mode 100644 index 0000000..ca2ac4a --- /dev/null +++ b/old-tests/test/generated/utility.cxx @@ -0,0 +1 @@ +int main () {} diff --git a/old-tests/test/simple/build/bootstrap.build b/old-tests/test/simple/build/bootstrap.build new file mode 100644 index 0000000..0b7a347 --- /dev/null +++ b/old-tests/test/simple/build/bootstrap.build @@ -0,0 +1,4 @@ +project = test-simple +amalgamation = # Disabled. +using config +using test diff --git a/old-tests/test/simple/buildfile b/old-tests/test/simple/buildfile new file mode 100644 index 0000000..569c12c --- /dev/null +++ b/old-tests/test/simple/buildfile @@ -0,0 +1,12 @@ +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/old-tests/test/simple/driver.cxx b/old-tests/test/simple/driver.cxx new file mode 100644 index 0000000..3753821 --- /dev/null +++ b/old-tests/test/simple/driver.cxx @@ -0,0 +1,14 @@ +#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/old-tests/test/simple/test.out b/old-tests/test/simple/test.out new file mode 100644 index 0000000..5d63fab --- /dev/null +++ b/old-tests/test/simple/test.out @@ -0,0 +1 @@ +test is running (stdout) diff --git a/old-tests/test/simple/utility.cxx b/old-tests/test/simple/utility.cxx new file mode 100644 index 0000000..c4bb446 --- /dev/null +++ b/old-tests/test/simple/utility.cxx @@ -0,0 +1 @@ +void f (){} diff --git a/old-tests/using/buildfile b/old-tests/using/buildfile new file mode 100644 index 0000000..86baa42 --- /dev/null +++ b/old-tests/using/buildfile @@ -0,0 +1,5 @@ +using? foo +print $foo.loaded +print $foo.configured + +./: diff --git a/old-tests/variable/dir-path/buildfile b/old-tests/variable/dir-path/buildfile new file mode 100644 index 0000000..5c99f07 --- /dev/null +++ b/old-tests/variable/dir-path/buildfile @@ -0,0 +1,45 @@ +# 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/old-tests/variable/dir-path/test.out b/old-tests/variable/dir-path/test.out new file mode 100644 index 0000000..e608c42 --- /dev/null +++ b/old-tests/variable/dir-path/test.out @@ -0,0 +1,22 @@ +-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/old-tests/variable/dir-path/test.sh b/old-tests/variable/dir-path/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/dir-path/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/expansion/buildfile b/old-tests/variable/expansion/buildfile new file mode 100644 index 0000000..3f28372 --- /dev/null +++ b/old-tests/variable/expansion/buildfile @@ -0,0 +1,26 @@ +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/old-tests/variable/expansion/test.out b/old-tests/variable/expansion/test.out new file mode 100644 index 0000000..5056f04 --- /dev/null +++ b/old-tests/variable/expansion/test.out @@ -0,0 +1,6 @@ +FOO +FOO +FOO +FOO +foo +BAR diff --git a/old-tests/variable/expansion/test.sh b/old-tests/variable/expansion/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/expansion/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/null/buildfile b/old-tests/variable/null/buildfile new file mode 100644 index 0000000..3fa1a9e --- /dev/null +++ b/old-tests/variable/null/buildfile @@ -0,0 +1,22 @@ +#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/old-tests/variable/null/test.out b/old-tests/variable/null/test.out new file mode 100644 index 0000000..5119a71 --- /dev/null +++ b/old-tests/variable/null/test.out @@ -0,0 +1,7 @@ +[null] +[null] +[null] +[null] +[null] +[null] +[null] diff --git a/old-tests/variable/null/test.sh b/old-tests/variable/null/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/null/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/override/build/bootstrap.build b/old-tests/variable/override/build/bootstrap.build new file mode 100644 index 0000000..1c2e239 --- /dev/null +++ b/old-tests/variable/override/build/bootstrap.build @@ -0,0 +1,2 @@ +project = override +amalgamation = # Disabled. diff --git a/old-tests/variable/override/buildfile b/old-tests/variable/override/buildfile new file mode 100644 index 0000000..c090e81 --- /dev/null +++ b/old-tests/variable/override/buildfile @@ -0,0 +1,58 @@ +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/old-tests/variable/override/cache b/old-tests/variable/override/cache new file mode 100644 index 0000000..8378688 --- /dev/null +++ b/old-tests/variable/override/cache @@ -0,0 +1,13 @@ +x = [string] 0 +print $x + +x = [uint64] 1 +print $x + +y = 0 +print $y + +[uint64] y = [null] +print $y + +./: diff --git a/old-tests/variable/override/p/build/bootstrap.build b/old-tests/variable/override/p/build/bootstrap.build new file mode 100644 index 0000000..723e2a3 --- /dev/null +++ b/old-tests/variable/override/p/build/bootstrap.build @@ -0,0 +1 @@ +project = override-p diff --git a/old-tests/variable/override/p/buildfile b/old-tests/variable/override/p/buildfile new file mode 100644 index 0000000..527b9ae --- /dev/null +++ b/old-tests/variable/override/p/buildfile @@ -0,0 +1,49 @@ +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/old-tests/variable/override/p/loader b/old-tests/variable/override/p/loader new file mode 100644 index 0000000..f298dcc --- /dev/null +++ b/old-tests/variable/override/p/loader @@ -0,0 +1 @@ +include ../buildfile diff --git a/old-tests/variable/override/simple b/old-tests/variable/override/simple new file mode 100644 index 0000000..899daa2 --- /dev/null +++ b/old-tests/variable/override/simple @@ -0,0 +1,3 @@ +print $foo + +./: diff --git a/old-tests/variable/override/test.sh b/old-tests/variable/override/test.sh new file mode 100755 index 0000000..a8b08b2 --- /dev/null +++ b/old-tests/variable/override/test.sh @@ -0,0 +1,312 @@ +#! /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/old-tests/variable/prepend/buildfile b/old-tests/variable/prepend/buildfile new file mode 100644 index 0000000..896f99d --- /dev/null +++ b/old-tests/variable/prepend/buildfile @@ -0,0 +1,14 @@ +foo =+ FOO +print $foo + +foo =+ foo +print $foo + +foo = foo +print $foo + +foo =+ FOO +foo += FOO +print $foo + +./: diff --git a/old-tests/variable/prepend/test.out b/old-tests/variable/prepend/test.out new file mode 100644 index 0000000..80b77d0 --- /dev/null +++ b/old-tests/variable/prepend/test.out @@ -0,0 +1,4 @@ +FOO +foo FOO +foo +FOO foo FOO diff --git a/old-tests/variable/prepend/test.sh b/old-tests/variable/prepend/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/prepend/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/qualified/buildfile b/old-tests/variable/qualified/buildfile new file mode 100644 index 0000000..870b808 --- /dev/null +++ b/old-tests/variable/qualified/buildfile @@ -0,0 +1,27 @@ +#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/old-tests/variable/qualified/test.out b/old-tests/variable/qualified/test.out new file mode 100644 index 0000000..5bf062e --- /dev/null +++ b/old-tests/variable/qualified/test.out @@ -0,0 +1,12 @@ +foo:bar +foo:bar +foo:bar +foo:bar +foo/:bar +foo/file{fox}:bar +bar +Bar +BAR +BBAARR +Bar +bar diff --git a/old-tests/variable/qualified/test.sh b/old-tests/variable/qualified/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/qualified/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/representation/build/bootstrap.build b/old-tests/variable/representation/build/bootstrap.build new file mode 100644 index 0000000..6a48e2e --- /dev/null +++ b/old-tests/variable/representation/build/bootstrap.build @@ -0,0 +1,4 @@ +project = variable-representation +amalgamation = # Disabled. +using config +using test diff --git a/old-tests/variable/representation/buildfile b/old-tests/variable/representation/buildfile new file mode 100644 index 0000000..b9c213d --- /dev/null +++ b/old-tests/variable/representation/buildfile @@ -0,0 +1,34 @@ +# @@ 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/old-tests/variable/representation/driver.cxx b/old-tests/variable/representation/driver.cxx new file mode 100644 index 0000000..ecff9e2 --- /dev/null +++ b/old-tests/variable/representation/driver.cxx @@ -0,0 +1,10 @@ +#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/old-tests/variable/representation/test.out b/old-tests/variable/representation/test.out new file mode 100644 index 0000000..84e7250 --- /dev/null +++ b/old-tests/variable/representation/test.out @@ -0,0 +1,20 @@ +'-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/old-tests/variable/representation/test.sh b/old-tests/variable/representation/test.sh new file mode 100755 index 0000000..da9e0e9 --- /dev/null +++ b/old-tests/variable/representation/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +b test + diff --git a/old-tests/variable/type-pattern-append/buildfile b/old-tests/variable/type-pattern-append/buildfile new file mode 100644 index 0000000..a91b340 --- /dev/null +++ b/old-tests/variable/type-pattern-append/buildfile @@ -0,0 +1,59 @@ +# 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/old-tests/variable/type-pattern-append/test.out b/old-tests/variable/type-pattern-append/test.out new file mode 100644 index 0000000..e8e2242 --- /dev/null +++ b/old-tests/variable/type-pattern-append/test.out @@ -0,0 +1,7 @@ +abc +b c +a b +a b c +ab +ab +abc diff --git a/old-tests/variable/type-pattern-append/test.sh b/old-tests/variable/type-pattern-append/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/type-pattern-append/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/type-pattern/buildfile b/old-tests/variable/type-pattern/buildfile new file mode 100644 index 0000000..dd218ac --- /dev/null +++ b/old-tests/variable/type-pattern/buildfile @@ -0,0 +1,39 @@ +#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/old-tests/variable/type/buildfile b/old-tests/variable/type/buildfile new file mode 100644 index 0000000..a22cddd --- /dev/null +++ b/old-tests/variable/type/buildfile @@ -0,0 +1,84 @@ +# 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/old-tests/variable/type/test.out b/old-tests/variable/type/test.out new file mode 100644 index 0000000..5218221 --- /dev/null +++ b/old-tests/variable/type/test.out @@ -0,0 +1,12 @@ +foobarbaz +foobarbaz +0 0 0 +00 +2 +2 +2 +2 +0 +0 +0 +abc diff --git a/old-tests/variable/type/test.sh b/old-tests/variable/type/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/type/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/version/buildfile b/old-tests/version/buildfile new file mode 100644 index 0000000..eaf2f77 --- /dev/null +++ b/old-tests/version/buildfile @@ -0,0 +1,31 @@ +#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 + +./: |