Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for optional, explicit test names.
- Loading branch information
Showing
29 changed files
with
588 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
pavlov.specify "Example Specifications", -> | ||
describe "", -> | ||
foo = "bar" | ||
describe "When testing should equal", -> | ||
expectThat -> foo.should equal "bar" | ||
describe "When testing shouldnt equal", -> | ||
expectThat -> foo.shouldnt equal "baz" | ||
describe "When testing to and be", -> | ||
expectThat -> foo.should be equal to "bar" | ||
expectThat -> foo.shouldnt be equal to "bah" | ||
describe "When testing for true", -> | ||
expectThat -> (foo is "bar").should be true | ||
expectThat -> (foo is "baz").shouldnt be true | ||
describe "When testing for false", -> | ||
expectThat -> (foo is "baz").should be false | ||
expectThat -> (foo is "bar").shouldnt be false | ||
describe "When testing for null or undefined", -> | ||
testNull = null | ||
testUndefined = undefined | ||
expectThat -> (testNull is null).should be true | ||
expectThat -> (testNull isnt null).shouldnt be true | ||
expectThat -> (testUndefined is undefined).should be true | ||
expectThat -> (testUndefined is undefined).shouldnt be false | ||
describe "When testing for throw", -> | ||
expectThat -> (-> throw "test exception").should throwException | ||
expectThat -> (-> throw "test exception").should throwException "test exception" | ||
describe "When testing for greater than", -> | ||
expectThat -> 10.should be greaterThan 9 | ||
expectThat -> 9.1.shouldnt be greaterThan 10 | ||
describe "When testing for less than", -> | ||
expectThat -> 10.should be lessThan 11 | ||
expectThat -> 10.1.shouldnt be lessThan 10 | ||
describe "When testing with the example custom matcher", -> | ||
expectThat -> 10.should be atleastTwoGreaterThan 8 | ||
expectThat -> 10.shouldnt be atleastTwoGreaterThan 9 | ||
foo = "bar" | ||
describe "When testing should equal", -> | ||
expectThat -> foo.should equal "bar" | ||
describe "When testing shouldnt equal", -> | ||
expectThat -> foo.shouldnt equal "baz" | ||
describe "When testing to and be", -> | ||
expectThat -> foo.should be equal to "bar" | ||
expectThat -> foo.shouldnt be equal to "bah" | ||
describe "When testing for true", -> | ||
expectThat -> (foo is "bar").should be true | ||
expectThat -> (foo is "baz").shouldnt be true | ||
describe "When testing for false", -> | ||
expectThat -> (foo is "baz").should be false | ||
expectThat -> (foo is "bar").shouldnt be false | ||
describe "When testing for null or undefined", -> | ||
testNull = null | ||
testUndefined = undefined | ||
expectThat -> (testNull is null).should be true | ||
expectThat -> (testNull isnt null).shouldnt be true | ||
expectThat -> (testUndefined is undefined).should be true | ||
expectThat -> (testUndefined is undefined).shouldnt be false | ||
describe "When testing for throw", -> | ||
expectThat -> (-> throw "test exception").should throwException | ||
expectThat -> (-> throw "test exception").should throwException "test exception" | ||
describe "When testing for greater than", -> | ||
expectThat -> 10.should be greaterThan 9 | ||
expectThat -> 9.1.shouldnt be greaterThan 10 | ||
describe "When testing for less than", -> | ||
expectThat -> 10.should be lessThan 11 | ||
expectThat -> 10.1.shouldnt be lessThan 10 | ||
describe "When testing with the example custom matcher", -> | ||
expectThat -> 10.should be atleastTwoGreaterThan 8 | ||
expectThat -> 10.shouldnt be atleastTwoGreaterThan 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,92 @@ | ||
|
||
pavlov.specify("Example Specifications", function() { | ||
return describe("", function() { | ||
var foo; | ||
foo = "bar"; | ||
describe("When testing should equal", function() { | ||
return expectThat(function() { | ||
return foo.should(equal("bar")); | ||
}); | ||
}); | ||
describe("When testing shouldnt equal", function() { | ||
return expectThat(function() { | ||
return foo.shouldnt(equal("baz")); | ||
}); | ||
}); | ||
describe("When testing to and be", function() { | ||
expectThat(function() { | ||
return foo.should(be(equal(to("bar")))); | ||
}); | ||
return expectThat(function() { | ||
return foo.shouldnt(be(equal(to("bah")))); | ||
}); | ||
}); | ||
describe("When testing for true", function() { | ||
expectThat(function() { | ||
return (foo === "bar").should(be(true)); | ||
}); | ||
return expectThat(function() { | ||
return (foo === "baz").shouldnt(be(true)); | ||
}); | ||
}); | ||
describe("When testing for false", function() { | ||
expectThat(function() { | ||
return (foo === "baz").should(be(false)); | ||
}); | ||
return expectThat(function() { | ||
return (foo === "bar").shouldnt(be(false)); | ||
}); | ||
}); | ||
describe("When testing for null or undefined", function() { | ||
var testNull, testUndefined; | ||
testNull = null; | ||
testUndefined = void 0; | ||
expectThat(function() { | ||
return (testNull === null).should(be(true)); | ||
}); | ||
expectThat(function() { | ||
return (testNull !== null).shouldnt(be(true)); | ||
}); | ||
expectThat(function() { | ||
return (testUndefined === void 0).should(be(true)); | ||
}); | ||
return expectThat(function() { | ||
return (testUndefined === void 0).shouldnt(be(false)); | ||
}); | ||
}); | ||
describe("When testing for throw", function() { | ||
expectThat(function() { | ||
return (function() { | ||
throw "test exception"; | ||
}).should(throwException); | ||
}); | ||
return expectThat(function() { | ||
return (function() { | ||
throw "test exception"; | ||
}).should(throwException("test exception")); | ||
}); | ||
}); | ||
describe("When testing for greater than", function() { | ||
expectThat(function() { | ||
return 10..should(be(greaterThan(9))); | ||
}); | ||
return expectThat(function() { | ||
return 9.1.shouldnt(be(greaterThan(10))); | ||
}); | ||
}); | ||
describe("When testing for less than", function() { | ||
expectThat(function() { | ||
return 10..should(be(lessThan(11))); | ||
}); | ||
return expectThat(function() { | ||
return 10.1.shouldnt(be(lessThan(10))); | ||
}); | ||
}); | ||
return describe("When testing with the example custom matcher", function() { | ||
expectThat(function() { | ||
return 10..should(be(atleastTwoGreaterThan(8))); | ||
}); | ||
return expectThat(function() { | ||
return 10..shouldnt(be(atleastTwoGreaterThan(9))); | ||
}); | ||
var foo; | ||
foo = "bar"; | ||
describe("When testing should equal", function() { | ||
return expectThat(function() { | ||
return foo.should(equal("bar")); | ||
}); | ||
}); | ||
describe("When testing shouldnt equal", function() { | ||
return expectThat(function() { | ||
return foo.shouldnt(equal("baz")); | ||
}); | ||
}); | ||
describe("When testing to and be", function() { | ||
expectThat(function() { | ||
return foo.should(be(equal(to("bar")))); | ||
}); | ||
return expectThat(function() { | ||
return foo.shouldnt(be(equal(to("bah")))); | ||
}); | ||
}); | ||
describe("When testing for true", function() { | ||
expectThat(function() { | ||
return (foo === "bar").should(be(true)); | ||
}); | ||
return expectThat(function() { | ||
return (foo === "baz").shouldnt(be(true)); | ||
}); | ||
}); | ||
describe("When testing for false", function() { | ||
expectThat(function() { | ||
return (foo === "baz").should(be(false)); | ||
}); | ||
return expectThat(function() { | ||
return (foo === "bar").shouldnt(be(false)); | ||
}); | ||
}); | ||
describe("When testing for null or undefined", function() { | ||
var testNull, testUndefined; | ||
testNull = null; | ||
testUndefined = void 0; | ||
expectThat(function() { | ||
return (testNull === null).should(be(true)); | ||
}); | ||
expectThat(function() { | ||
return (testNull !== null).shouldnt(be(true)); | ||
}); | ||
expectThat(function() { | ||
return (testUndefined === void 0).should(be(true)); | ||
}); | ||
return expectThat(function() { | ||
return (testUndefined === void 0).shouldnt(be(false)); | ||
}); | ||
}); | ||
describe("When testing for throw", function() { | ||
expectThat(function() { | ||
return (function() { | ||
throw "test exception"; | ||
}).should(throwException); | ||
}); | ||
return expectThat(function() { | ||
return (function() { | ||
throw "test exception"; | ||
}).should(throwException("test exception")); | ||
}); | ||
}); | ||
describe("When testing for greater than", function() { | ||
expectThat(function() { | ||
return 10..should(be(greaterThan(9))); | ||
}); | ||
return expectThat(function() { | ||
return 9.1.shouldnt(be(greaterThan(10))); | ||
}); | ||
}); | ||
describe("When testing for less than", function() { | ||
expectThat(function() { | ||
return 10..should(be(lessThan(11))); | ||
}); | ||
return expectThat(function() { | ||
return 10.1.shouldnt(be(lessThan(10))); | ||
}); | ||
}); | ||
return describe("When testing with the example custom matcher", function() { | ||
expectThat(function() { | ||
return 10..should(be(atleastTwoGreaterThan(8))); | ||
}); | ||
return expectThat(function() { | ||
return 10..shouldnt(be(atleastTwoGreaterThan(9))); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.