Permalink
Browse files

syntax highlightning

  • Loading branch information...
1 parent 926dea0 commit 7064697087a6f72f62fd948175c7fa89c0f52723 @danseid committed Dec 4, 2012
Showing with 25 additions and 2 deletions.
  1. +25 −2 README.md
View
@@ -40,12 +40,13 @@ Equal <matchfunction> should only be used on types, that implement equals functi
####be | !be any
Match the result to any object in a list
-
+ ```kotlin
1 should be any of(1,2,3) //✔ of is a convenient function to create a list
1 should be any arrayList(1,2,3) //✔ same as above
"abc" should be any of("cab", "bac", "abc") //✔
4 should !be any of(1,2,3) //✔
4 should !be any of (1,2,4) //✘
+ ```
####match | !match condition
Match condition to any object
@@ -65,71 +66,93 @@ book should !match condition { title == "Title" && author == "Author" //✘
###Number
Matchers to use on number objects like Int, Float, Double ...
#### be | !be gt |greaterThan
+```kotlin
1 should be gt 0.0 //✔
1 should be greaterThan 0 //✔ same as above
1 should !be gt 1 //✔
1.9 should !be gt 2 //✔
1 should be gt 1 //✘
1 should be gt 2 //✘
+```
#### be | !be gte | greaterOrEqualThan
+```kotlin
1 should be gte 0 //✔
1 should be greaterOrEqualThan 0 //✔ same as above
1 should be gte 1 //✔
1 should !be gte 2 //✔
1 should !be gte 1 //✘
1 should be gte 2 //✘
+```
#### be | !be lt | lessThan
+```kotlin
1.5 should be lt 2 //✔
1 should be lessThan 2 //✔ same as above
1 should !be lt 1 //✔
1 should !be lt 0 //✔
1 should be lt 1 //✘
1 should be lt 0 //✘
+```
#### be | !be lte | lessOrEqualThan
+```kotlin
1 should be lte 2 //✔
1 should be lessOrEqualThan 2 //✔ same as above
1 should be lte 1 //✔
1 should !be lte 0 //✔
1 should !be lte 1 //✘
1 should be lte 0 //✘
+```
#### be | !be in range()
- 1 should be in range(1..2) //✔
+```kotlin
+ 1 should be in range(1..2) //✔
1 should be in range(1.0..2.0) //✔
1.1 should be in range(1..2) //✔
1 should !be in range(1.1..2.0) //✔
1.0 should !be in range(1.1..2.0) //✔
1.99 should !be in range(2..3) //✔
1.99 should !be in range(1.991..1.992) //✔
1 should !be in range(0.9..0.99); //✔
+```
###String
Matchers to use on string objects
####have | !have length
+```kotlin
"string" should have length 6 //✔
"" should !have length 1 //✔
"string" should have length 0 //✘
+```
####start | !start with
+```kotlin
"string" should start with "str" //✔
"string" should !start with "tring" //✔
"string" should start with "ing" //✘
+```
####end | !end with
+```kotlin
"string" should end with "ing" //✔
"string" should !end with "in" //✔
"string" should end with "strin" //✘
+```
####contain | !contain any
+```kotlin
"string" should contain any of("s", "t", "a") //✔
"string" should !contain any of("a", "b", "c") //✔
"string" should contain any of("a", "b", "c") //✘
+```
####contain | !contain all
+```kotlin
"string" should contain all of("s", "t", "r") //✔
"string" should !contain all of("a", "b", "c") //✔
"string" should contain all of("s", "t", "a") //✘
+```
###Function
Matchers to use on () : R -> function
####fail | !fail with
+```kotlin
{throw NullPointerException()} should fail with NullPointerException() //✔
{1 should be equal 1} should !fail with AssertionError() //✔
{"string" should be equal "string"} should fail with AssertionError() //✘
+```

0 comments on commit 7064697

Please sign in to comment.