Created
June 29, 2009 03:41
-
-
Save Mikoangelo/137453 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Speck.describe("Array") { | |
.before(#each) { | |
.array: @(1,2,3,4,5) | |
} | |
it.d("should allow negative indices") { | |
.array.get(-1).should() = 5 | |
.array.get(-5).should() = 1 | |
} | |
it.d("should return nil for negative indices out of bounds") { | |
Speck.pending("Throwing a string causes a segfault at the moment.") | |
.array.get(-60).should() = nil | |
} | |
it.d("shouldn't allow setting bad negative indices") { | |
{ | |
.array.set(-60, #yourmom) | |
}.should().throw() | |
} | |
} |
This file contains hidden or 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
$ ./speck.sn examples/* | |
Array should allow negative indices: success | |
Array should return nil for negative indices out of bounds: pending | |
Array shouldn't allow setting bad negative indices: success | |
Your mother should be true: success | |
Your mother should not be false: success | |
The wrong mother should not be true: failure 1 | |
An exceptional mother should gently lob: success | |
An exceptional mother failingly shouldn’t throw defaultily: failure 2 | |
An exceptional mother failingly explicitly shouldn’t throw: failure 3 | |
An exceptional mother failingly should, but doesn't: failure 4 | |
Failure #1: The wrong mother should not be true | |
Expected anything but `true', but got `true'. | |
Failure #2: An exceptional mother failingly shouldn’t throw defaultily | |
WHEEEEEEEEE | |
Failure #3: An exceptional mother failingly explicitly shouldn’t throw | |
WHOOOOOOOOO | |
Failure #4: An exceptional mother failingly should, but doesn't | |
An exception was expected, but none was thrown. | |
5 successes, 1 pending, 4 failures (10 total) |
This file contains hidden or 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
Speck.describe("Your mother") { | |
it.d("should be true") { | |
true.should() = true | |
} | |
it.d("should not be false") { | |
false.should_not() = true | |
} | |
} | |
Speck.describe("The wrong mother") { | |
it.d("should not be true") { | |
true.should_not() = true | |
} | |
} | |
Speck.describe("An exceptional mother") { | |
it.d("should gently lob") { | |
{ | |
throw(#cantaloupe) | |
}.should().throw() | |
} | |
.describe("failingly") { | |
it.d("shouldn’t throw defaultily") { | |
throw(#WHEEEEEEEEE) | |
} | |
it.d("explicitly shouldn’t throw") { | |
{ throw(#WHOOOOOOOOO) }.should_not().throw() | |
} | |
it.d("should, but doesn't") { | |
{}.should().throw() | |
} | |
} | |
} |
This file contains hidden or 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
http://j.meta.io/d0dade6407ac42514cf442eb1026b53f.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment