summaryrefslogtreecommitdiff
path: root/Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-26 11:32:46 +0800
committerchai <chaifix@163.com>2021-10-26 11:32:46 +0800
commit0549b1e5a8a3132005e275d6026db8003cb067d2 (patch)
treef0d7751ec32ecf5c4d23997fa0ffd3450a5a755a /Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua
parent32345800737b668011a87328cd3dcce59ec2934c (diff)
*rename folder
Diffstat (limited to 'Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua')
-rw-r--r--Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua140
1 files changed, 0 insertions, 140 deletions
diff --git a/Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua b/Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua
deleted file mode 100644
index c73a6d3..0000000
--- a/Resources/Libraries/luaunit/test/legacy_example_with_luaunit.lua
+++ /dev/null
@@ -1,140 +0,0 @@
-EXPORT_ASSERT_TO_GLOBALS = true
-require('luaunit')
-
-TestToto = {} --class
-
- function TestToto:setUp()
- -- set up tests
- self.a = 1
- self.s = 'hop'
- self.t1 = {1,2,3}
- self.t2 = {one=1,two=2,three=3}
- self.t3 = {1,2,three=3}
- end
-
- function TestToto:test1_withFailure()
- print( "some stuff test 1" )
- assertEquals( self.a , 1 )
- -- will fail
- assertEquals( self.a , 2 )
- assertEquals( self.a , 2 )
- end
-
- function TestToto:test2_withFailure()
- print( "some stuff test 2" )
- assertEquals( self.a , 1 )
- assertEquals( self.s , 'hop' )
- -- will fail
- assertEquals( self.s , 'bof' )
- assertEquals( self.s , 'bof' )
- end
-
- function TestToto:test3()
- print( "some stuff test 3" )
- assertEquals( self.a , 1 )
- assertEquals( self.s , 'hop' )
- assertEquals( type(self.a), 'number' )
- end
-
- function TestToto:test4()
- print( "some stuff test 4" )
- assertNotEquals( self.a , 1 )
- end
-
- function TestToto:test5()
- print( "some stuff test 5" )
- assertTrue( self.a )
- assertFalse( self.a )
- end
-
- function TestToto:test6()
- print( "some stuff test 6" )
- assertTrue( false )
- end
-
- function TestToto:test7()
- -- assertEquals( {1,2}, self.t1 )
- -- assertEquals( {1,2}, self.t2 )
- assertEquals( {1,2}, self.t3 )
- end
-
- function TestToto:test8a()
- -- failure occurs in a submethod
- self:funcWithError()
- end
-
- function TestToto:test8b()
- -- failure occurs in a submethod
- self:funcWithFuncWithError()
- end
-
- function TestToto:funcWithFuncWithError()
- self:funcWithError()
- end
-
- function TestToto:funcWithError()
- error('Bouhouhoum error!')
- end
-
-
--- class TestToto
-
-TestTiti = {} --class
- function TestTiti:setUp()
- -- set up tests
- self.a = 1
- self.s = 'hop'
- print( 'TestTiti:setUp' )
- end
-
- function TestTiti:tearDown()
- -- some tearDown() code if necessary
- print( 'TestTiti:tearDown' )
- end
-
- function TestTiti:test1_withFailure()
- print( "some stuff test 1" )
- assertEquals( self.a , 1 )
- -- will fail
- assertEquals( self.a , 2 )
- assertEquals( self.a , 2 )
- end
-
- function TestTiti:test2_withFailure()
- print( "some stuff test 2" )
- assertEquals( self.a , 1 )
- assertEquals( self.s , 'hop' )
- -- will fail
- assertEquals( self.s , 'bof' )
- assertEquals( self.s , 'bof' )
- end
-
- function TestTiti:test3()
- print( "some stuff test 3" )
- assertEquals( self.a , 1 )
- assertEquals( self.s , 'hop' )
- end
--- class TestTiti
-
--- simple test functions that were written previously can be integrated
--- in luaunit too
-function test1_withFailure()
- assert( 1 == 1)
- -- will fail
- assert( 1 == 2)
-end
-
-function test2_withFailure()
- assert( 'a' == 'a')
- -- will fail
- assert( 'a' == 'b')
-end
-
-function test3()
- assert( 1 == 1)
- assert( 'a' == 'a')
-end
-
-local lu = LuaUnit.new()
-lu:setOutputType("tap")
-os.exit( lu:runSuite() )