summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-01 20:26:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-10-01 20:26:51 -0700
commitf913686407f54b66a4ae13f7361f45ef66423781 (patch)
tree8a351596de202c301212b2d7154342382f0e3234 /tests
parent10cda159132822dd9c77199409fe09ff9f4d7417 (diff)
downloadtxr-f913686407f54b66a4ae13f7361f45ef66423781.tar.gz
txr-f913686407f54b66a4ae13f7361f45ef66423781.tar.bz2
txr-f913686407f54b66a4ae13f7361f45ef66423781.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/008/configfile28
-rw-r--r--tests/008/configfile.expected4
-rw-r--r--tests/008/configfile.txr24
3 files changed, 56 insertions, 0 deletions
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)