summaryrefslogtreecommitdiff
path: root/t/comp/asstcompat.t
diff options
context:
space:
mode:
Diffstat (limited to 't/comp/asstcompat.t')
-rw-r--r--t/comp/asstcompat.t40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/comp/asstcompat.t b/t/comp/asstcompat.t
new file mode 100644
index 0000000000..fa0a357837
--- /dev/null
+++ b/t/comp/asstcompat.t
@@ -0,0 +1,40 @@
+#!./perl
+
+my $i = 1;
+sub ok {
+ my $ok = shift;
+ print( ($ok ? '' : 'not '), "ok $i", (@_ ? " - @_" : ''), "\n");
+ $i++;
+}
+
+print "1..7\n";
+
+# 1
+use base 'assertions::compat';
+ok(eval "sub assert_foo : assertion { 0 } ; 1", "handle assertion attribute");
+
+use assertions::activate 'Foo';
+
+# 2
+use assertions::compat asserting_2 => 'Foo';
+ok(asserting_2, 'on');
+
+# 3
+use assertions::compat asserting_3 => 'Bar';
+ok(!asserting_3, 'off');
+
+# 4
+use assertions::compat asserting_4 => '_ || Bar';
+ok(!asserting_4, 'current off or off');
+
+# 5
+use assertions::compat asserting_5 => '_ || Foo';
+ok(asserting_5, 'current off or on');
+
+# 6
+use assertions::compat asserting_6 => '_ || Bar';
+ok(asserting_6, 'current on or off');
+
+# 7
+use assertions::compat asserting_7 => '_ && Foo';
+ok(asserting_7, 'current on and on');