gb.test plan TestAllAsserts
This commit is contained in:
parent
beb88b488c
commit
21500e1667
1 changed files with 15 additions and 8 deletions
|
@ -4,12 +4,14 @@
|
|||
|
||||
Public Sub TestAssert()
|
||||
|
||||
Test.Plan(1)
|
||||
Assert.Ok(True, "Testing True")
|
||||
|
||||
End
|
||||
|
||||
Public Sub TestAssertEmpty()
|
||||
|
||||
Test.Plan(2)
|
||||
Assert.Null("", "Empty with \"\"")
|
||||
Assert.Null(Null, "Empty with Null")
|
||||
|
||||
|
@ -19,6 +21,7 @@ Public Sub TestAssertEqualsFloat()
|
|||
|
||||
Dim f As Float
|
||||
|
||||
Test.Plan(1)
|
||||
f = 0.55555555555555
|
||||
Assert.Approximate(f, 0.55555555555555, 0, "Check with equal floats")
|
||||
|
||||
|
@ -29,7 +32,7 @@ Public Sub TestAssertEqualsLong()
|
|||
Dim l As Long
|
||||
|
||||
l = 555555555555555555
|
||||
|
||||
Test.Plan(1)
|
||||
Assert.Equals(555555555555555555, l, "Check long")
|
||||
|
||||
End
|
||||
|
@ -43,7 +46,7 @@ Public Sub TestAssertEqualsDate()
|
|||
d = Now()
|
||||
sdate = CString(d)
|
||||
d2 = CDate(sdate)
|
||||
|
||||
Test.Plan(1)
|
||||
Assert.Equals(d, d2, "Check with equal dates")
|
||||
|
||||
End
|
||||
|
@ -54,7 +57,7 @@ Public Sub TestAssertEqualsObject()
|
|||
Dim s2 As Object
|
||||
|
||||
s2 = s
|
||||
|
||||
Test.Plan(1)
|
||||
Assert.Equals(s2, s, "Equal Objects")
|
||||
|
||||
End
|
||||
|
@ -65,13 +68,14 @@ Public Sub TestAssertEqualsString()
|
|||
|
||||
s1 = "blaahhh"
|
||||
s2 = "blaahhh"
|
||||
|
||||
Test.Plan(1)
|
||||
Assert.StringEquals(s1, s2, "Equal Strings")
|
||||
|
||||
End
|
||||
|
||||
Public Sub TestAssertNotNull()
|
||||
|
||||
Test.Plan(2)
|
||||
Assert.NotNull("" & Null & 1, "String is not Null")
|
||||
Assert.NotNull(Me, "Object is not Null")
|
||||
|
||||
|
@ -80,8 +84,9 @@ End
|
|||
Public Sub TestAssertError()
|
||||
|
||||
Dim r As Float
|
||||
|
||||
Test.Plan(1)
|
||||
Try r = 2 / 0
|
||||
|
||||
Assert.Error("Test error")
|
||||
|
||||
End
|
||||
|
@ -89,7 +94,7 @@ End
|
|||
Public Sub TestAssertErrorCode()
|
||||
|
||||
Dim r As Float
|
||||
|
||||
Test.Plan(1)
|
||||
Try r = 2 / 0
|
||||
Assert.ErrorCode(26, "Test error with code")
|
||||
|
||||
|
@ -98,7 +103,8 @@ End
|
|||
Public Sub TestTodoErrorCode()
|
||||
|
||||
Dim r As Float
|
||||
|
||||
Test.Plan(2)
|
||||
|
||||
Try r = 2 / 1
|
||||
Assert.Todo("See automatic diagnostics 1/2")
|
||||
Assert.ErrorCode(26, "Division by zero?")
|
||||
|
@ -111,6 +117,7 @@ End
|
|||
|
||||
Public Sub TestNote()
|
||||
|
||||
Test.Plan(0)
|
||||
Test.Note("The next note is Null and that's alright:")
|
||||
Test.Note(Null)
|
||||
Test.SkipAll("This doesn't actually assert anything")
|
||||
|
@ -118,7 +125,7 @@ Public Sub TestNote()
|
|||
End
|
||||
|
||||
Public Sub TestLike()
|
||||
|
||||
Test.Plan(2)
|
||||
Assert.Like("Gambas", "G*", "Gambas like G*")
|
||||
Assert.Like("Gambas", "?[Aa]*", "Gambas Like \"?[Aa]*\"")
|
||||
|
||||
|
|
Loading…
Reference in a new issue