summaryrefslogtreecommitdiffstats
path: root/test/test_parse_cmdline
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2016-07-06 13:22:16 +0200
committerDave Reisner <dreisner@archlinux.org>2016-07-07 14:30:59 +0200
commitb9308a5296fc0dc8da78cd6f02a5af9c38f0a044 (patch)
treeecfa5b08409b65424cdcf4a063bc0d33fecbd5c2 /test/test_parse_cmdline
parenta089c8622708d5249aa7830590464fb29dc799a4 (diff)
downloadmkinitcpio-b9308a5296fc0dc8da78cd6f02a5af9c38f0a044.tar.gz
mkinitcpio-b9308a5296fc0dc8da78cd6f02a5af9c38f0a044.tar.xz
refactor parse_cmdline into something more readable
This refactors parse_cmdline into a few chunks of code, mainly to separate the work of parsing from the handling of the actual parsed parameters. By default, parse_cmdline_item is used as the callback for handling the parameters, but this could be overriden by other code sourcing init_functions if desirable. Our test harness passes more tests, but we leave behind some expected failures to describe the cases where it still fails. Fortunately I've not yet been able to find any cases which warrant --expect-parse-fail.
Diffstat (limited to 'test/test_parse_cmdline')
-rwxr-xr-xtest/test_parse_cmdline16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/test_parse_cmdline b/test/test_parse_cmdline
index 9afd9cb..ff855e4 100755
--- a/test/test_parse_cmdline
+++ b/test/test_parse_cmdline
@@ -130,19 +130,19 @@ test_parse 'foo="bar baz"' \
'foo' 'bar baz'
# single quoting
-test_parse --expect-fail "foo='bar'" \
+test_parse "foo='bar'" \
'foo' 'bar'
-test_parse --expect-parse-fail "foo='bar baz'" \
+test_parse "foo='bar baz'" \
'foo' 'bar baz'
# dangling quotes
-test_parse --expect-fail 'foo="bar' \
+test_parse 'foo="bar' \
'foo' '"bar'
test_parse 'foo=bar"' \
'foo' 'bar"'
# nested quotes
-test_parse --expect-parse-fail "foo='\"bar baz\"' herp='\"de\"rp'" \
+test_parse "foo='\"bar baz\"' herp='\"de\"rp'" \
'foo' '"bar baz"' \
'herp' '"de"rp'
@@ -174,9 +174,9 @@ test_parse 'foo="bar #baz" parse=this' \
# shell metachars
test_parse 'foo=*' \
'foo' '\*'
-test_parse --expect-fail 'Make*' \
+test_parse 'Make*' \
'Makefile' ''
-test_parse --expect-fail '[Makefile]*' \
+test_parse '[Makefile]*' \
'Makefile' '' \
'init' '' \
'functions' ''
@@ -184,7 +184,7 @@ test_parse --expect-fail '[Makefile]*' \
# invalid names
test_parse 'in-valid=name'
test_parse '6foo=bar'
-test_parse --expect-parse-fail '"gar bage"' \
+test_parse '"gar bage"' \
'gar' '' \
'bage' ''
@@ -197,7 +197,7 @@ test_parse 'ro' \
'ro' '' \
'rw' '' \
'rwopt' 'ro'
-test_parse --expect-fail 'fstype=btrfs' \
+test_parse 'fstype=btrfs' \
'rootfstype' 'btrfs'
test_parse 'fsck.mode=force' \
'forcefsck' 'y' \