Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "test"
- local test = Test:new("Test")
- test:describe("isEqual()", {
- test:it("should pass a test, because zero is equal zero", function(expect)
- expect(0):isEqual(0)
- end),
- test:it("shouldn't pass a test, because zero is not equal one", function(expect)
- expect(0):isEqual(1)
- end)
- })
- test:describe("isNotEqual()", {
- test:it("should pass a test, because zero is not equal one", function(expect)
- expect(0):isNotEqual(1)
- end),
- test:it("shouldn't pass a test, because zero is equal zero", function(expect)
- expect(0):isNotEqual(0)
- end)
- })
- test:describe("isLess()", {
- test:it("should pass a test, because zero is less than one", function(expect)
- expect(0):isLess(1)
- end),
- test:it("shouldn't pass a test, because one isn't less than zero", function(expect)
- expect(1):isLess(0)
- end)
- })
- test:describe("isLarge()", {
- test:it("should pass a test, because one is large than zero", function(expect)
- expect(1):isLarge(0)
- end),
- test:it("shouldn't pass a test, because zero isn't large than one", function(expect)
- expect(0):isLarge(1)
- end)
- })
- test:describe("isLessOrEqual()", {
- test:it("should pass a test, because zero is equal zero", function(expect)
- expect(0):isLessOrEqual(0)
- end),
- test:it("should pass a test, because zero is less than one", function(expect)
- expect(0):isLessOrEqual(1)
- end),
- test:it("shouldn't pass a test, because one isn't less than zero", function(expect)
- expect(1):isLessOrEqual(0)
- end)
- })
- test:describe("isLargeOrEqual()", {
- test:it("should pass a test, because zero is equal zero", function(expect)
- expect(0):isLargeOrEqual(0)
- end),
- test:it("shouldn't pass a test, because zero isn't large than one", function(expect)
- expect(0):isLargeOrEqual(1)
- end),
- test:it("should pass a test, because one is large than zero", function(expect)
- expect(1):isLargeOrEqual(0)
- end)
- })
- test:describe("isTrue()", {
- test:it("should pass a test, because true is true", function(expect)
- expect(true):isTrue()
- end),
- test:it("shouldn't pass a test, because false isn't true", function(expect)
- expect(false):isTrue()
- end),
- test:it("shouldn't pass a test, because (0 > 1) return false", function(expect)
- expect(0 > 1):isTrue()
- end),
- test:it("should pass a test, because (0 < 1) return true", function(expect)
- expect(0 < 1):isTrue()
- end)
- })
- test:describe("isFalse()", {
- test:it("should pass a test, because false is false", function(expect)
- expect(false):isFalse()
- end),
- test:it("shouldn't pass a test, because true isn't false", function(expect)
- expect(true):isFalse()
- end),
- test:it("shouldn't pass a test, because (0 < 1) return true", function(expect)
- expect(0 < 1):isFalse()
- end),
- test:it("should pass a test, because (0 > 1) return false", function(expect)
- expect(0 > 1):isFalse()
- end)
- })
- test:describe("isNil()", {
- test:it("should pass a test, because nil is nil", function(expect)
- expect(nil):isNil()
- end),
- test:it("shouldn't pass a test, because 1 isn't nil", function(expect)
- expect(1):isNil()
- end),
- test:it("shouldn't pass a test, because first element of this table {0, 1} isn't nil", function(expect)
- local table = {0, 1}
- expect(table[1]):isNil()
- end),
- test:it("should pass a test, because third element of this table {0, 1} is nil because it not existed", function(expect)
- local table = {0, 1}
- expect(table[3]):isNil()
- end)
- })
- test:describe("isNotNil()", {
- test:it("should pass a test, because 1 isn't nil", function(expect)
- expect(1):isNotNil()
- end),
- test:it("shouldn't pass a test, because nil is nil", function(expect)
- expect(nil):isNotNil()
- end),
- test:it("should pass a test, because first element of this table {0, 1} isn't nil", function(expect)
- local table = {0, 1}
- expect(table[1]):isNotNil()
- end),
- test:it("shouldn't pass a test, because third element of this table {0, 1} is nil because it not existed", function(expect)
- local table = {0, 1}
- expect(table[3]):isNotNil()
- end)
- })
- test:describe("throwError()", {
- test:it("should pass test, because function throw error", function(expect)
- expect((function() error("Test Error") end)):throwError("Test Error")
- end),
- test:it("shouldn't pass test, because function throw anexpected error", function(expect)
- expect((function() error("anexpected Error") end)):throwError("Test Error")
- end),
- test:it("should pass test, because function doesn't throw any error", function(expect)
- expect((function() end)):throwError("Test Error")
- end)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement