Permalink
Browse files

Added Test::Builder::is() and Test::Builder::isnt() methods for compa…

…ring values.
  • Loading branch information...
1 parent d703024 commit 668e841f2fd2ac35eb0d5fa5df787c4b2877fd61 @soh-cah-toa committed Oct 2, 2011
Showing with 22 additions and 2 deletions.
  1. +22 −2 lib/Test/Builder.pm
View
24 lib/Test/Builder.pm
@@ -112,13 +112,33 @@ class Test::Builder:<soh_cah_toa 0.0.1>;
return $passed;
}
- method todo(Mu $passed, Str $description = '', Str $reason = '') {
+ method is(Mu $got, Mu $expected, Str $description= '') {
+ my Bool $test = ?$got eq ?$expected;
+
+ self!report_test(Test::Builder::Test.new(:number(self!get_test_number),
+ :passed($test),
+ :description($description)));
+
+ return $test;
+ }
+
+ method isnt(Mu $got, Mu $expected, Str $description= '') {
+ my Bool $test = ?$got ne ?$expected;
+
+ self!report_test(Test::Builder::Test.new(:number(self!get_test_number),
+ :passed($test),
+ :description($description)));
+
+ return $test;
+ }
+
+ method todo(Mu $todo, Str $description = '', Str $reason = '') {
self!report_test(Test::Builder::Test.new(:todo(Bool::True),
:number(self!get_test_number),
:reason($reason),
:description($description)));
- return $passed;
+ return $todo;
}
method !report_test(Test::Builder::Test::Base $test) {

0 comments on commit 668e841

Please sign in to comment.