diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-11 18:12:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-11 18:12:09 +0200 |
commit | c552070230c4ad9c92b516c28658b5c74c57e46b (patch) | |
tree | bc78a4c9c5c9bfb21539e3e65f713a7f0daa766b /tests/manifest | |
parent | 294f8e8d3abebaaa976c7d21248a1a205c869b02 (diff) |
Outline of parsing and serialization for manifest object model
Diffstat (limited to 'tests/manifest')
-rw-r--r-- | tests/manifest/buildfile | 11 | ||||
-rw-r--r-- | tests/manifest/driver.cxx | 46 | ||||
-rw-r--r-- | tests/manifest/manifest | 4 |
3 files changed, 61 insertions, 0 deletions
diff --git a/tests/manifest/buildfile b/tests/manifest/buildfile new file mode 100644 index 0000000..ee23ca9 --- /dev/null +++ b/tests/manifest/buildfile @@ -0,0 +1,11 @@ +# file : tests/manifest/buildfile +# copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +import libs += libbutl #@@ hack to get -I + +exe{driver}: cxx{driver} ../../bpkg/lib{bpkg} $libs + +include ../../bpkg/ + +# test: ./driver manifest | diff -u manifest - diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx new file mode 100644 index 0000000..ff6005c --- /dev/null +++ b/tests/manifest/driver.cxx @@ -0,0 +1,46 @@ +// file : tests/manifest/driver.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <fstream> +#include <iostream> + +#include <bpkg/manifest> +#include <bpkg/manifest-parser> +#include <bpkg/manifest-serializer> + +using namespace std; +using namespace bpkg; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " <file>" << endl; + return 1; + } + + try + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1], ifstream::in | ifstream::binary); + + manifest_parser p (ifs, argv[1]); + manifests ms (p); + + manifest_serializer s (cout, "stdout"); + ms.serialize (s); + } + catch (const ios_base::failure&) + { + cerr << "io failure" << endl; + return 1; + } + catch (const std::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} diff --git a/tests/manifest/manifest b/tests/manifest/manifest new file mode 100644 index 0000000..25491ef --- /dev/null +++ b/tests/manifest/manifest @@ -0,0 +1,4 @@ +: 1 +name: libfoo +: +name: libbar |