aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest-parser
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manifest-parser')
-rw-r--r--tests/manifest-parser/buildfile5
-rwxr-xr-xtests/manifest-parser/driver31
l---------tests/manifest-parser/libbutl1
-rw-r--r--tests/manifest-parser/testscript23
4 files changed, 60 insertions, 0 deletions
diff --git a/tests/manifest-parser/buildfile b/tests/manifest-parser/buildfile
new file mode 100644
index 0000000..1dfe0d3
--- /dev/null
+++ b/tests/manifest-parser/buildfile
@@ -0,0 +1,5 @@
+# file : tests/manifest-parser/buildfile
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: testscript
diff --git a/tests/manifest-parser/driver b/tests/manifest-parser/driver
new file mode 100755
index 0000000..4cbea3e
--- /dev/null
+++ b/tests/manifest-parser/driver
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+function import ()
+{
+ # Here we don't assume the errors are trapped. If all goes well, our exit
+ # code is that of source (which fails if the file is not found).
+ #
+ local e; if ! e="$(realpath ${BASH_SOURCE[0]})"; then return 1; fi
+ local d; if ! d="$(dirname "$e")"; then return 1; fi
+ source "$d/$1.bash"
+}
+
+trap "{ exit 1; }" ERR
+set -o errtrace # Trap ERR in functions.
+
+import libbutl/manifest-parser
+
+# @@ parse_manifest failure ignored
+#
+# @@ what would be equivalent serialization interface? Just serialize one
+# name/value in manifest format (so explicit version).
+#
+while IFS=': ' read -r -d '' n v; do
+ if [ -z "$n" ]; then
+ echo "$v"
+ else
+ echo # Extra newline after first pair.
+ echo "$n"
+ echo "$v"
+ fi
+done < <(parse_manifest)
diff --git a/tests/manifest-parser/libbutl b/tests/manifest-parser/libbutl
new file mode 120000
index 0000000..6d1c4c0
--- /dev/null
+++ b/tests/manifest-parser/libbutl
@@ -0,0 +1 @@
+../../libbutl \ No newline at end of file
diff --git a/tests/manifest-parser/testscript b/tests/manifest-parser/testscript
new file mode 100644
index 0000000..6a95286
--- /dev/null
+++ b/tests/manifest-parser/testscript
@@ -0,0 +1,23 @@
+# file : tests/manifest-parser/testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+$* >>EOO
+1
+
+name
+foo
+
+version
+1.2.3
+
+description
+foo
+executable
+
+depends
+libfoo
+
+depends
+libbar
+EOO