summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-07-07 17:44:35 -0500
committerJesse Luehrs <doy@tozt.net>2011-07-07 17:44:35 -0500
commitc17bd97635464c13298b177797da2fb3d02974bc (patch)
tree1388d8d800a8a583a7597b3af2e62cd6c9e5b160 /t
parenta90f35e18274df56f4d2aa2a8ddb4e01bfe24b93 (diff)
downloadsmartmatch-engine-rjbs-c17bd97635464c13298b177797da2fb3d02974bc.tar.gz
smartmatch-engine-rjbs-c17bd97635464c13298b177797da2fb3d02974bc.zip
tests
Diffstat (limited to 't')
-rw-r--r--t/lexical.t69
-rw-r--r--t/lib/lexical.pl8
2 files changed, 77 insertions, 0 deletions
diff --git a/t/lexical.t b/t/lexical.t
new file mode 100644
index 0000000..036fe8a
--- /dev/null
+++ b/t/lexical.t
@@ -0,0 +1,69 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+{
+ ok(1 ~~ 1);
+ ok(!(1 ~~ 0));
+ {
+ ok(1 ~~ 1);
+ ok(!(1 ~~ 0));
+ use smartmatch sub { 0 };
+ ok(!(1 ~~ 1));
+ ok(!(1 ~~ 0));
+ {
+ ok(!(1 ~~ 1));
+ ok(!(1 ~~ 0));
+ use smartmatch sub { 1 };
+ ok(1 ~~ 1);
+ ok(1 ~~ 0);
+ use smartmatch sub { 0 };
+ ok(!(1 ~~ 1));
+ ok(!(1 ~~ 0));
+ use smartmatch sub { 1 };
+ ok(1 ~~ 1);
+ ok(1 ~~ 0);
+ }
+ ok(!(1 ~~ 1));
+ ok(!(1 ~~ 0));
+ }
+ ok(1 ~~ 1);
+ ok(!(1 ~~ 0));
+}
+
+{
+ ok(eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+ {
+ ok(eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+ use smartmatch sub { 0 };
+ ok(!eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+ {
+ ok(!eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+ use smartmatch sub { 1 };
+ ok(eval "1 ~~ 1");
+ ok(eval "1 ~~ 0");
+ use smartmatch sub { 0 };
+ ok(!eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+ use smartmatch sub { 1 };
+ ok(eval "1 ~~ 1");
+ ok(eval "1 ~~ 0");
+ }
+ ok(!eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+ }
+ ok(eval "1 ~~ 1");
+ ok(!eval "1 ~~ 0");
+}
+
+{
+ use smartmatch sub { 0 };
+ require 't/lib/lexical.pl';
+}
+
+done_testing;
diff --git a/t/lib/lexical.pl b/t/lib/lexical.pl
new file mode 100644
index 0000000..d004c3f
--- /dev/null
+++ b/t/lib/lexical.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+Test::More::ok(1 ~~ 1);
+Test::More::ok(!(1 ~~ 0));
+
+1;