summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-08-15 16:51:54 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-08-15 17:04:02 +0000
commit583a840ff77a327089c45c45a9eb912df3165100 (patch)
tree1f8539c73056fe381d7feb3278589e06619094e0 /yarns
parentd976da7db86519a4c926e89a61bf129777751861 (diff)
downloadmorph-583a840ff77a327089c45c45a9eb912df3165100.tar.gz
Add "morph print-architecture" subcommand
Diffstat (limited to 'yarns')
-rw-r--r--yarns/print-architecture.yarn42
1 files changed, 42 insertions, 0 deletions
diff --git a/yarns/print-architecture.yarn b/yarns/print-architecture.yarn
new file mode 100644
index 00000000..e45d7d1b
--- /dev/null
+++ b/yarns/print-architecture.yarn
@@ -0,0 +1,42 @@
+"morph print-architecture" tests
+================================
+
+This is short and simple. Morph can print the name for the current
+architecture, and we verify not that it is correct, but that exactly
+one line is printed to the standard output. The reason we're not
+checking it's correct is because that would require the test code
+to duplicate the architecture name list that is in the code already,
+and that wouldn't help with tests. However, verifying there's exactly
+one line in stdout (and nothing in stderr) means the plugin does at
+least something sensible.
+
+Oh, and the one line should contain no spaces, either.
+
+ SCENARIO morph print-architecture prints out a single word
+ WHEN morph print-architecture is run
+ THEN stdout contains a single line
+ AND stdout contains no spaces
+ AND stderr is empty
+
+ IMPLEMENTS WHEN morph print-architecture is run
+ run_morph print-architecture > "$DATADIR/stdout" 2> "$DATADIR/stderr"
+
+ IMPLEMENTS THEN stdout contains a single line
+ n=$(wc -l < "$DATADIR/stdout")
+ if [ "$n" != 1 ]
+ then
+ die "stdout contains $n lines, not 1"
+ fi
+
+ IMPLEMENTS THEN stdout contains no spaces
+ n=$(tr < "$DATADIR/stdout" -cd ' ' | wc -c)
+ if [ "$n" != 0 ]
+ then
+ die "stdout contains spaces"
+ fi
+
+ IMPLEMENTS THEN stderr is empty
+ if [ -s "$DATADIR/stderr" ]
+ then
+ die "stderr is not empty"
+ fi