summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--Makefile3
-rw-r--r--tests/008/configfile28
-rw-r--r--tests/008/configfile.expected4
-rw-r--r--tests/008/configfile.txr24
5 files changed, 72 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 29db472c..3f5fb6eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2011-10-01 Kaz Kylheku <kaz@kylheku.com>
+ New test case under tests/008.
+
+ * Makefile: Made previous TXR_ARGS for 008 specific
+ to tokenizing test case, and introduced separate TXR_ARGS
+ for this test case.
+
+ * tests/008/configfile: New file.
+
+ * tests/008/configfile.expected: New file.
+
+ * tests/008/configfile.txr: New file.
+
+2011-10-01 Kaz Kylheku <kaz@kylheku.com>
+
Tokenizing test case, exercising for @(coll :gap 0)
and horizontal @(choose :shortest ...).
diff --git a/Makefile b/Makefile
index 82202f65..93c5b479 100644
--- a/Makefile
+++ b/Makefile
@@ -86,7 +86,8 @@ tests/002/%: TXR_OPTS := -DTESTDIR=$(top_srcdir)/tests/002
tests/004/%: TXR_ARGS := -a 123 -b -c
tests/005/%: TXR_ARGS := $(top_srcdir)/tests/005/data
tests/006/%: TXR_ARGS := $(top_srcdir)/tests/006/data
-tests/008/%: TXR_ARGS := $(top_srcdir)/tests/008/data
+tests/008/tokenize.ok: TXR_ARGS := $(top_srcdir)/tests/008/data
+tests/008/configfile.ok: TXR_ARGS := $(top_srcdir)/tests/008/configfile
tests/002/%: TXR_SCRIPT_ON_CMDLINE := y
diff --git a/tests/008/configfile b/tests/008/configfile
new file mode 100644
index 00000000..d7400606
--- /dev/null
+++ b/tests/008/configfile
@@ -0,0 +1,28 @@
+# This is a configuration file in standard configuration file format
+#
+# Lines begininning with a hash or a semicolon are ignored by the application
+# program. Blank lines are also ignored by the application program.
+
+# This is the fullname parameter
+FULLNAME Foo Barber
+
+# This is a favourite fruit
+FAVOURITEFRUIT banana
+
+# This is a boolean that should be set
+NEEDSPEELING
+
+# This boolean is commented out
+; SEEDSREMOVED
+
+# Configuration option names are not case sensitive, but configuration parameter
+# data is case sensitive and may be preserved by the application program.
+
+# An optional equals sign can be used to separate configuration parameter data
+# from the option name. This is dropped by the parser.
+
+# A configuration option may take multiple parameters separated by commas.
+# Leading and trailing whitespace around parameter names and parameter data fields
+# are ignored by the application program.
+
+OTHERFAMILY Rhu Barber, Harry Barber
diff --git a/tests/008/configfile.expected b/tests/008/configfile.expected
new file mode 100644
index 00000000..10dca68a
--- /dev/null
+++ b/tests/008/configfile.expected
@@ -0,0 +1,4 @@
+FULLNAME = Foo Barber;
+FAVOURITEFRUIT = banana;
+NEEDSPEELING = true;
+OTHERFAMILY = { Rhu Barber, Harry Barber };
diff --git a/tests/008/configfile.txr b/tests/008/configfile.txr
new file mode 100644
index 00000000..257fdc07
--- /dev/null
+++ b/tests/008/configfile.txr
@@ -0,0 +1,24 @@
+@(collect)
+@ (cases)
+#@/.*/
+@ (or)
+;@/.*/
+@ (or)
+@{IDENT /[A-Z_][A-Z_0-9]+/}@/ */
+@(bind VAL ("true"))
+@ (or)
+@{IDENT /[A-Z_][A-Z_0-9]+/}@(coll)@/ */@{VAL /[^,]+/}@/ */@(end)
+@ (or)
+@{IDENT /[A-Z_][A-Z_0-9]+/}@(coll)@/ */@{VAL /[^, ]+/}@/,? */@(end)
+@(flatten VAL)
+@ (or)
+@/ */
+@ (or)
+@ (throw error "bad configuration syntax")
+@ (end)
+@(end)
+@(output)
+@ (repeat)
+@IDENT = @(rep)@VAL, @(first){ @VAL, @(last)@VAL };@(single)@VAL;@(end)
+@ (end)
+@(end)