summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAntti-Juhani Kaijanaho <ajk@debian.org>2009-12-05 12:42:49 +0200
committerAntti-Juhani Kaijanaho <ajk@debian.org>2009-12-05 12:42:49 +0200
commit2bc3218cf4f70db497b97687b0d4bc3a847ec217 (patch)
tree75ca96f35e54037d4b0be8c82fb4247405d45284 /tests
parent761e32c1684dba651874b5e638fc65c9a56d56c2 (diff)
downloaddctrl-tools-2bc3218cf4f70db497b97687b0d4bc3a847ec217.tar.gz
Add support for #-comments
Debian Policy allows, in debian/control, lines that start with the '#'-character. Those lines are treated as comments by Policy, and ignored. This patch adds parser support for these comments in dctrl-tools. Unfortunately, it is not possible (without major changes) to ignore those comments semantically, since dctrl-tools represents paragraphs and fields as substrings of the input file. Accordingly, what this patch does is allow the parser to not choke on comments. Comments found inside a paragraph are left semantically significant (ie. part of the field body in which they are found), while comments otside of paragraphs are elided. Signed-off-by: Antti-Juhani Kaijanaho <ajk@debian.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/0009.in9
-rw-r--r--tests/0009.out8
-rw-r--r--tests/0009.sh5
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/0009.in b/tests/0009.in
new file mode 100644
index 0000000..f6d485e
--- /dev/null
+++ b/tests/0009.in
@@ -0,0 +1,9 @@
+# abc
+Foo: bar
+# baz
+Xyzzy: foo
+#ytty
+
+# ccd
+Sdd: gh
+goo: gaa
diff --git a/tests/0009.out b/tests/0009.out
new file mode 100644
index 0000000..7c6c2de
--- /dev/null
+++ b/tests/0009.out
@@ -0,0 +1,8 @@
+Foo: bar
+# baz
+Xyzzy: foo
+#ytty
+
+Sdd: gh
+goo: gaa
+
diff --git a/tests/0009.sh b/tests/0009.sh
new file mode 100644
index 0000000..5e2204f
--- /dev/null
+++ b/tests/0009.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+$GREP_DCTRL ''