From 8bfea593baaf587ff63134fadb9166c995acef1f Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 1 Apr 2017 19:38:37 +0300 Subject: [PATCH] Add lots of tests --- MANIFEST | 21 +++++++++++++++++++++ t/confused.t | 11 +++++++++++ t/disable-die.t | 1 - t/intermediate-direct.t | 4 ++++ t/intermediate-indirect.t | 4 ++++ t/intermediate-unrelated.t | 5 +++++ t/lax-direct.t | 4 ++++ t/lax-indirect.t | 4 ++++ t/lax-unrelated.t | 5 +++++ t/strict-die.t | 1 - t/t3/Evil.pm | 3 +++ t/t3/IntermediateDirect.pm | 4 ++++ t/t3/IntermediateIndirect.pm | 4 ++++ t/t3/LaxDirect.pm | 4 ++++ t/t3/LaxIndirect.pm | 4 ++++ t/t3/UnrelatedIntermediate.pm | 3 +++ t/t3/UnrelatedLax.pm | 3 +++ t/t3/UsesEvil.pm | 3 +++ t/t4/ConfusedIntermediate1.pm | 4 ++++ t/t4/ConfusedIntermediate2.pm | 4 ++++ t/t4/ConfusedLax1.pm | 4 ++++ t/t4/ConfusedLax2.pm | 4 ++++ t/t4/ConfusedStrict1.pm | 4 ++++ t/t4/ConfusedStrict2.pm | 4 ++++ 24 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 t/confused.t create mode 100644 t/intermediate-direct.t create mode 100644 t/intermediate-indirect.t create mode 100644 t/intermediate-unrelated.t create mode 100644 t/lax-direct.t create mode 100644 t/lax-indirect.t create mode 100644 t/lax-unrelated.t create mode 100644 t/t3/Evil.pm create mode 100644 t/t3/IntermediateDirect.pm create mode 100644 t/t3/IntermediateIndirect.pm create mode 100644 t/t3/LaxDirect.pm create mode 100644 t/t3/LaxIndirect.pm create mode 100644 t/t3/UnrelatedIntermediate.pm create mode 100644 t/t3/UnrelatedLax.pm create mode 100644 t/t3/UsesEvil.pm create mode 100644 t/t4/ConfusedIntermediate1.pm create mode 100644 t/t4/ConfusedIntermediate2.pm create mode 100644 t/t4/ConfusedLax1.pm create mode 100644 t/t4/ConfusedLax2.pm create mode 100644 t/t4/ConfusedStrict1.pm create mode 100644 t/t4/ConfusedStrict2.pm diff --git a/MANIFEST b/MANIFEST index 56b0733..eb07351 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3,8 +3,15 @@ lib/evil.pm Makefile.PL MANIFEST README +t/confused.t t/disable-die.t t/disable-safe.t +t/intermediate-direct.t +t/intermediate-indirect.t +t/intermediate-unrelated.t +t/lax-direct.t +t/lax-indirect.t +t/lax-unrelated.t t/strict-die.t t/strict-safe.t t/t1/Direct.pm @@ -14,3 +21,17 @@ t/t1/Unrelated.pm t/t2/Dies.pm t/t2/Evil.pm t/t2/Survives.pm +t/t3/Evil.pm +t/t3/IntermediateDirect.pm +t/t3/IntermediateIndirect.pm +t/t3/LaxDirect.pm +t/t3/LaxIndirect.pm +t/t3/UnrelatedIntermediate.pm +t/t3/UnrelatedLax.pm +t/t3/UsesEvil.pm +t/t4/ConfusedIntermediate1.pm +t/t4/ConfusedIntermediate2.pm +t/t4/ConfusedLax1.pm +t/t4/ConfusedLax2.pm +t/t4/ConfusedStrict1.pm +t/t4/ConfusedStrict2.pm diff --git a/t/confused.t b/t/confused.t new file mode 100644 index 0000000..8371dd8 --- /dev/null +++ b/t/confused.t @@ -0,0 +1,11 @@ +#!/usr/bin/perl +use Test::More tests => 6; + +ok !eval {require t::t4::ConfusedStrict1 }, 'Confused strict 1 dies'; +%evil::wants_strict = (); +ok !eval {require t::t4::ConfusedIntermediate1 }, 'Confused intermediate 1 dies'; +ok !eval {require t::t4::ConfusedLax1 }, 'Confused lax 1 dies'; +ok !eval {require t::t4::ConfusedStrict2 }, 'Confused strict 2 dies'; +%evil::wants_strict = (); +ok !eval {require t::t4::ConfusedIntermediate2 }, 'Confused intermediate 2 dies'; +ok !eval {require t::t4::ConfusedLax2 }, 'Confused lax 2 dies'; diff --git a/t/disable-die.t b/t/disable-die.t index 0dec9bd..9b81c92 100644 --- a/t/disable-die.t +++ b/t/disable-die.t @@ -2,4 +2,3 @@ use Test::More tests => 1; ok !eval { require t::t2::Dies }, 'Unrelated dies'; - diff --git a/t/intermediate-direct.t b/t/intermediate-direct.t new file mode 100644 index 0000000..6b48cce --- /dev/null +++ b/t/intermediate-direct.t @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use Test::More tests => 1; + +ok !eval {require t::t3::IntermediateDirect }, 'Direct intermediate dies'; diff --git a/t/intermediate-indirect.t b/t/intermediate-indirect.t new file mode 100644 index 0000000..51ecb7a --- /dev/null +++ b/t/intermediate-indirect.t @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use Test::More tests => 1; + +ok !eval {require t::t3::IntermediateIndirect }, 'Indirect intermediate dies'; diff --git a/t/intermediate-unrelated.t b/t/intermediate-unrelated.t new file mode 100644 index 0000000..c731050 --- /dev/null +++ b/t/intermediate-unrelated.t @@ -0,0 +1,5 @@ +#!/usr/bin/perl +use Test::More tests => 2; + +require_ok 't::t3::Evil'; +require_ok 't::t3::UnrelatedIntermediate'; diff --git a/t/lax-direct.t b/t/lax-direct.t new file mode 100644 index 0000000..89db622 --- /dev/null +++ b/t/lax-direct.t @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use Test::More tests => 1; + +ok !eval {require t::t3::LaxDirect }, 'Direct lax dies'; diff --git a/t/lax-indirect.t b/t/lax-indirect.t new file mode 100644 index 0000000..ed63156 --- /dev/null +++ b/t/lax-indirect.t @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use Test::More tests => 1; + +require_ok 't::t3::LaxIndirect'; diff --git a/t/lax-unrelated.t b/t/lax-unrelated.t new file mode 100644 index 0000000..3f0d705 --- /dev/null +++ b/t/lax-unrelated.t @@ -0,0 +1,5 @@ +#!/usr/bin/perl +use Test::More tests => 2; + +require_ok 't::t3::Evil'; +require_ok 't::t3::UnrelatedLax'; diff --git a/t/strict-die.t b/t/strict-die.t index 4d7aa28..a43b699 100644 --- a/t/strict-die.t +++ b/t/strict-die.t @@ -5,4 +5,3 @@ require_ok 't::t1::Evil'; require_ok 't::t1::Direct'; require_ok 't::t1::Indirect'; ok !eval { require t::t1::Unrelated }, 'Unrelated dies'; - diff --git a/t/t3/Evil.pm b/t/t3/Evil.pm new file mode 100644 index 0000000..fa7b2e3 --- /dev/null +++ b/t/t3/Evil.pm @@ -0,0 +1,3 @@ +package t::t3::Evil; +use evil; +1; diff --git a/t/t3/IntermediateDirect.pm b/t/t3/IntermediateDirect.pm new file mode 100644 index 0000000..cd83d13 --- /dev/null +++ b/t/t3/IntermediateDirect.pm @@ -0,0 +1,4 @@ +package t::t3::IntermediateDirect; +no evil; +use t::t3::Evil; +1; diff --git a/t/t3/IntermediateIndirect.pm b/t/t3/IntermediateIndirect.pm new file mode 100644 index 0000000..7936428 --- /dev/null +++ b/t/t3/IntermediateIndirect.pm @@ -0,0 +1,4 @@ +package t::t3::IntermediateIndirect; +no evil; +use t::t3::UsesEvil; +1; diff --git a/t/t3/LaxDirect.pm b/t/t3/LaxDirect.pm new file mode 100644 index 0000000..31b6bc1 --- /dev/null +++ b/t/t3/LaxDirect.pm @@ -0,0 +1,4 @@ +package t::t3::LaxDirect; +no evil ':lax'; +use t::t3::Evil; +1; diff --git a/t/t3/LaxIndirect.pm b/t/t3/LaxIndirect.pm new file mode 100644 index 0000000..ec11e10 --- /dev/null +++ b/t/t3/LaxIndirect.pm @@ -0,0 +1,4 @@ +package t::t3::LaxIndirect; +no evil ':lax'; +use t::t3::UsesEvil; +1; diff --git a/t/t3/UnrelatedIntermediate.pm b/t/t3/UnrelatedIntermediate.pm new file mode 100644 index 0000000..909187c --- /dev/null +++ b/t/t3/UnrelatedIntermediate.pm @@ -0,0 +1,3 @@ +package t::t3::UnrelatedIntermediate; +no evil; +1; diff --git a/t/t3/UnrelatedLax.pm b/t/t3/UnrelatedLax.pm new file mode 100644 index 0000000..c20d655 --- /dev/null +++ b/t/t3/UnrelatedLax.pm @@ -0,0 +1,3 @@ +package t::t3::UnrelatedLax; +no evil ':lax'; +1; diff --git a/t/t3/UsesEvil.pm b/t/t3/UsesEvil.pm new file mode 100644 index 0000000..f10310a --- /dev/null +++ b/t/t3/UsesEvil.pm @@ -0,0 +1,3 @@ +package t::t3::UsesEvil; +use t::t3::Evil; +1; diff --git a/t/t4/ConfusedIntermediate1.pm b/t/t4/ConfusedIntermediate1.pm new file mode 100644 index 0000000..702c65a --- /dev/null +++ b/t/t4/ConfusedIntermediate1.pm @@ -0,0 +1,4 @@ +#!/usr/bin/perl +no evil; +use evil; +1; diff --git a/t/t4/ConfusedIntermediate2.pm b/t/t4/ConfusedIntermediate2.pm new file mode 100644 index 0000000..158f9f9 --- /dev/null +++ b/t/t4/ConfusedIntermediate2.pm @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use evil; +no evil; +1; diff --git a/t/t4/ConfusedLax1.pm b/t/t4/ConfusedLax1.pm new file mode 100644 index 0000000..9827533 --- /dev/null +++ b/t/t4/ConfusedLax1.pm @@ -0,0 +1,4 @@ +#!/usr/bin/perl +no evil ':lax'; +use evil; +1; diff --git a/t/t4/ConfusedLax2.pm b/t/t4/ConfusedLax2.pm new file mode 100644 index 0000000..3801dd9 --- /dev/null +++ b/t/t4/ConfusedLax2.pm @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use evil; +no evil ':lax'; +1; diff --git a/t/t4/ConfusedStrict1.pm b/t/t4/ConfusedStrict1.pm new file mode 100644 index 0000000..6391085 --- /dev/null +++ b/t/t4/ConfusedStrict1.pm @@ -0,0 +1,4 @@ +#!/usr/bin/perl +no evil ':strict'; +use evil; +1; diff --git a/t/t4/ConfusedStrict2.pm b/t/t4/ConfusedStrict2.pm new file mode 100644 index 0000000..85519ab --- /dev/null +++ b/t/t4/ConfusedStrict2.pm @@ -0,0 +1,4 @@ +#!/usr/bin/perl +use evil; +no evil ':strict'; +1; -- 2.39.2