1#!perl -Tw 2 3use strict; 4 5use Test::More tests => 5; 6use Test::Builder::Tester; 7use Test::Builder::Tester::Color; 8use Test::LongString; 9 10# In there 11test_out("ok 1 - Any chocolate in my peanut butter?"); 12lacks_string("Reese's Peanut Butter Cups", "Chocolate", "Any chocolate in my peanut butter?"); 13test_test("Lacking"); 14 15# Not in there 16test_out("not ok 1 - Any peanut butter in my chocolate?"); 17test_fail(4); 18test_diag(qq( searched: "Reese's Peanut Butter Cups")); 19test_diag(qq( and found: "Peanut Butter")); 20test_diag(qq! at position: 8 (line 1 column 9)!); 21lacks_string("Reese's Peanut Butter Cups", "Peanut Butter", "Any peanut butter in my chocolate?"); 22test_test("Not lacking"); 23 24# Multiple lines 25test_out("not ok 1 - Mild?"); 26test_fail(4); 27test_diag(qq( searched: "Stately, plump Buck Mulligan came from the stairhe"...)); 28test_diag(qq( and found: "mild")); 29test_diag(qq! at position: 195 (line 3 column 51)!); 30lacks_string(<<'EXAMPLE',"mild","Mild?"); 31Stately, plump Buck Mulligan came from the stairhead, bearing a bowl of 32lather on which a mirror and a razor lay crossed. A yellow dressinggown, 33ungirdled, was sustained gently behind him by the mild morning air. He 34held the bowl aloft and intoned: 35--Introibo ad altare dei. 36EXAMPLE 37test_test("Multiple lines not lacking"); 38 39# Source string undef 40test_out("not ok 1 - Look inside undef"); 41test_fail(2); 42test_diag(qq(String to look in is undef)); 43lacks_string(undef,"Orange everything", "Look inside undef"); 44test_test("Source string undef fails"); 45 46# Searching string undef 47test_out("not ok 1 - Look for undef"); 48test_fail(2); 49test_diag(qq(String to look for is undef)); 50lacks_string('"Fishnet" is not a color', undef, "Look for undef"); 51test_test("Substring undef fails"); 52