aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/buildtab/testscript22
-rw-r--r--tests/manifest/task.test21
-rw-r--r--tests/variable/buildfile9
-rw-r--r--tests/variable/driver.cxx61
-rw-r--r--tests/variable/testscript55
5 files changed, 33 insertions, 135 deletions
diff --git a/tests/buildtab/testscript b/tests/buildtab/testscript
index 5bf6b24..6bf76bc 100644
--- a/tests/buildtab/testscript
+++ b/tests/buildtab/testscript
@@ -48,11 +48,23 @@
: invalid-var
:
- $* <<EOI 2>>EOE == 1
- windows*-vc_14* windows-vc_14-32 config.cc.coptions="/Z7
- EOI
- cin:1:57: error: unterminated quoted string
- EOE
+ {
+ : unquoted
+ :
+ $* <<EOI 2>>EOE == 1
+ windows*-vc_14* windows-vc_14-32 config.cc.coptions="/Z7
+ EOI
+ cin:1:57: error: unterminated quoted string
+ EOE
+
+ : no-value
+ :
+ $* <<EOI 2>>EOE == 1
+ windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 config.cc.coptions
+ EOI
+ cin:1:64: error: no variable value
+ EOE
+ }
: dup-config-name
:
diff --git a/tests/manifest/task.test b/tests/manifest/task.test
index cbb4598..f2afd9c 100644
--- a/tests/manifest/task.test
+++ b/tests/manifest/task.test
@@ -198,10 +198,21 @@ test.options += -t
: bad-var
:
- $* <<EOI 2>'stdin:2:12: error: invalid task configuration: no variable value' == 1
- : 1
- config: abc xyz=1
- EOI
+ {
+ : no-value
+ :
+ $* <<EOI 2>'stdin:2:9: error: invalid task configuration: no variable value' == 1
+ : 1
+ config: abc xyz=1
+ EOI
+
+ : no-assignment
+ :
+ $* <<EOI 2>'stdin:2:9: error: invalid task configuration: expected variable assignment' == 1
+ : 1
+ config: 'abc xyz'=1
+ EOI
+ }
: multiline
:
@@ -217,7 +228,7 @@ test.options += -t
: bad-var
:
- $* <<EOI 2>'stdin:3:4: error: invalid task configuration: no variable value' == 1
+ $* <<EOI 2>'stdin:3:1: error: invalid task configuration: no variable value' == 1
: 1
config: \
abc xyz=1
diff --git a/tests/variable/buildfile b/tests/variable/buildfile
deleted file mode 100644
index e9c0cf2..0000000
--- a/tests/variable/buildfile
+++ /dev/null
@@ -1,9 +0,0 @@
-# file : tests/variable/buildfile
-# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-# license : MIT; see accompanying LICENSE file
-
-import libs = libbutl%lib{butl}
-
-exe{driver}: cxx{driver} ../../bbot/lib{bbot} $libs test{testscript}
-
-include ../../bbot/
diff --git a/tests/variable/driver.cxx b/tests/variable/driver.cxx
deleted file mode 100644
index 88167ad..0000000
--- a/tests/variable/driver.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-// file : tests/variable/driver.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#include <ios> // ios_base::failbit, ios_base::badbit
-#include <string>
-#include <cassert>
-#include <cstddef> // size_t
-#include <iostream>
-
-#include <butl/utility> // operator<<(ostream,exception)
-
-#include <bbot/variable>
-
-using namespace std;
-using namespace butl;
-using namespace bbot;
-
-// Usage: argv[0] [-u]
-//
-// Read variables from STDIN (one per line) and serialize them to STDOUT (also
-// one per line).
-//
-// -u output variables being unquoted beforehand
-//
-int
-main (int argc, char* argv[])
-{
- assert (argc <= 2);
- bool unquote (false);
-
- if (argc == 2)
- {
- assert (argv[1] == string ("-u"));
- unquote = true;
- }
-
- cin.exceptions (ios_base::badbit);
- cout.exceptions (ios_base::failbit | ios_base::badbit);
-
- string s;
- for (size_t l (1); getline (cin, s); ++l)
- {
- try
- {
- variable v (move (s));
-
- cout << (unquote
- ? v.unquoted ()
- : static_cast<const string&> (v))
- << '\n';
- }
- catch (const invalid_variable& e)
- {
- cerr << l << ':' << 1 + e.pos << ": error: " << e << endl;
- return 1;
- }
- }
-
- return 0;
-}
diff --git a/tests/variable/testscript b/tests/variable/testscript
deleted file mode 100644
index 3269a37..0000000
--- a/tests/variable/testscript
+++ /dev/null
@@ -1,55 +0,0 @@
-# file : tests/variable/testscript
-# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-# license : MIT; see accompanying LICENSE file
-
-test.options += -u
-
-: valid
-:
-{
- $* <<EOI >>EOO
- config.cc.coptions="-O3 -stdlib='libc++'"
- ab'c="x y"'
- var=xy
- var=
- EOI
- config.cc.coptions=-O3 -stdlib='libc++'
- abc="x y"
- var=xy
- var=
- EOO
-}
-
-: invalid
-:
-{
- : expected-assignment
- :
- $* <'v"a r=abc"' 2>'1:4: error: expected variable assignment' == 1
-
- : unterminated-quoted-string
- :
- $* <'var="a b' 2>'1:9: error: unterminated quoted string' == 1
-
- : no-value
- :
- $* <'var' 2>'1:4: error: no variable value' == 1
-}
-
-: unquoting
-:
-{
- : single
- :
- $* <"var='a \" b'" >'var=a " b'
-
- : double
- :
- $* <'var="a '"'"' b"' >"var=a ' b"
-
- : mixed
- :
- $* <<EOI >'var=a bc e'
- var='a b'"c e"
- EOI
-}