diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-20 22:01:57 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-20 22:01:57 +0300 |
commit | 773fbb10eb59c4e855eccf9966a6ef3a68e3e0c3 (patch) | |
tree | 55178311afbf48536088fa4a83b3bf45d8ebcf0c /tests/variable/driver.cxx | |
parent | 4b9c521172a2c30a84f76fcedcec37247878a24f (diff) |
Get rid of variable struct
Diffstat (limited to 'tests/variable/driver.cxx')
-rw-r--r-- | tests/variable/driver.cxx | 61 |
1 files changed, 0 insertions, 61 deletions
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; -} |