1#!./perl -w 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = '../lib'; 6 require './test.pl'; 7} 8 9plan tests => 16; 10 11# Some of these will cause warnings if left on. Here we're checking the 12# functionality, not the warnings. 13no warnings "numeric"; 14 15# test cases based on [perl #36675] -'-10' eq '+10' 16is(- 10, -10, "Simple numeric negation to negative"); 17is(- -10, 10, "Simple numeric negation to positive"); 18is(-"10", -10, "Negation of a positive string to negative"); 19is(-"10.0", -10, "Negation of a positive decimal sting to negative"); 20is(-"10foo", -10, "Negation of a numeric-lead string returns negation of numeric"); 21is(-"-10", "+10", 'Negation of string starting with "-" returns a string starting with "+" - numeric'); 22is(-"-10.0", "+10.0", 'Negation of string starting with "-" returns a string starting with "+" - decimal'); 23is(-"-10foo", "+10foo", 'Negation of string starting with "-" returns a string starting with "+" - non-numeric'); 24is(-"xyz", "-xyz", 'Negation of a negative string adds "-" to the front'); 25is(-"-xyz", "+xyz", "Negation of a negative string to positive"); 26is(-"+xyz", "-xyz", "Negation of a positive string to negative"); 27is(-bareword, "-bareword", "Negation of bareword treated like a string"); 28is(- -bareword, "+bareword", "Negation of -bareword returns string +bareword"); 29is(-" -10", 10, "Negation of a whitespace-lead numeric string"); 30is(-" -10.0", 10, "Negation of a whitespace-lead decimal string"); 31is(-" -10foo", 10, "Negation of a whitespace-lead sting starting with a numeric") 32