summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/t/lib/parsewords.t
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/t/lib/parsewords.t')
-rw-r--r--gnu/usr.bin/perl/t/lib/parsewords.t28
1 files changed, 28 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/t/lib/parsewords.t b/gnu/usr.bin/perl/t/lib/parsewords.t
new file mode 100644
index 00000000000..47a75881dc7
--- /dev/null
+++ b/gnu/usr.bin/perl/t/lib/parsewords.t
@@ -0,0 +1,28 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+print "1..4\n";
+
+use Text::ParseWords;
+
+@words = shellwords(qq(foo "bar quiz" zoo));
+#print join(";", @words), "\n";
+
+print "not " if $words[0] ne 'foo';
+print "ok 1\n";
+
+print "not " if $words[1] ne 'bar quiz';
+print "ok 2\n";
+
+print "not " if $words[2] ne 'zoo';
+print "ok 3\n";
+
+# Test quotewords() with other parameters
+@words = quotewords(":+", 1, qq(foo:::"bar:foo":zoo zoo:));
+#print join(";", @words), "\n";
+print "not " unless join(";", @words) eq qq(foo;"bar:foo";zoo zoo);
+print "ok 4\n";