From c17bd97635464c13298b177797da2fb3d02974bc Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Jul 2011 17:44:35 -0500 Subject: tests --- t/lexical.t | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ t/lib/lexical.pl | 8 +++++++ 2 files changed, 77 insertions(+) create mode 100644 t/lexical.t create mode 100644 t/lib/lexical.pl (limited to 't') 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; -- cgit v1.2.3