summaryrefslogtreecommitdiff
path: root/test/iftoken.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-16 16:41:25 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-16 16:41:25 -0800
commitcbf768d67d5540681df5e6ea41fe1fb270c95eec (patch)
tree62d5f522c11af3e848bfd4dd8930d441dd8c3633 /test/iftoken.pl
parent88ab419cc6f190e52052942943fae7779a22c0e1 (diff)
downloadnasm-cbf768d67d5540681df5e6ea41fe1fb270c95eec.tar.gz
Implement %iftoken, test for a single token
Implement %iftoken, a test for a single token. This is useful in cases using %+ to splice a macro-provided token.
Diffstat (limited to 'test/iftoken.pl')
-rwxr-xr-xtest/iftoken.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/iftoken.pl b/test/iftoken.pl
new file mode 100755
index 00000000..bbbb5bcd
--- /dev/null
+++ b/test/iftoken.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+
+@list = ('1', '+1', '1 2', '1,2', 'foo', 'foo bar', '%', '+foo', '<<');
+
+foreach $t (@list) {
+ print "\tdb 'N \"$t\": '\n";
+ print "%iftoken $t\n";
+ print "\tdb 'Yes', 10\n";
+ print "%else\n";
+ print "\tdb 'No', 10\n";
+ print "%endif\n";
+
+ print "\tdb 'C \"$t\": '\n";
+ print "%iftoken $t ; With a comment!\n";
+ print "\tdb 'Yes', 10\n";
+ print "%else\n";
+ print "\tdb 'No', 10\n";
+ print "%endif\n";
+}