require 'test/unit' class TestTruncateOnMarjoree < Test::Unit::TestCase include Marjoree def setup $db.do( "CREATE TABLE TEST_TABLE( id int NOT NULL, value int NOT NULL )" ) $db.do( "INSERT INTO TEST_TABLE ( id, value ) VALUES( 0, 10 )" ) $db.do( "INSERT INTO TEST_TABLE ( id, value ) VALUES( 1, 11 )" ) end def test_truncate assert( num_rows( "TEST_TABLE" ) > 0 ) truncate( "TEST_TABLE" ) assert_equal( 0, num_rows( "TEST_TABLE" ) ) end def test_truncate_with_bad_table begin truncate( "TABLE_NOT_IN_DB" ) fail rescue ODBC::Error end end def teardown $db.do( "TRUNCATE TABLE TEST_TABLE" ) $db.do( "DROP TABLE TEST_TABLE" ) end end