Class TC_Mysql
In: test.rb
Parent: Test::Unit::TestCase

Methods

Public Instance methods

[Source]

    # File test.rb, line 8
 8:   def setup()
 9:     @host, @user, @pass, db, port, sock, flag = ARGV
10:     @db = db || "test"
11:     @port = port.to_i
12:     @sock = sock.nil? || sock.empty? ? nil : sock
13:     @flag = flag.to_i
14:   end

[Source]

    # File test.rb, line 15
15:   def teardown()
16:   end

[Source]

    # File test.rb, line 54
54:   def test_client_info()
55:     assert_match(/^\d.\d+.\d+$/, Mysql.client_info())
56:   end

[Source]

    # File test.rb, line 32
32:   def test_connect()
33:     assert_nothing_raised{@m = Mysql.connect(@host, @user, @pass, @db, @port, @sock, @flag)}
34:     assert_nothing_raised{@m.close}
35:   end

[Source]

    # File test.rb, line 84
84:   def test_connect2()
85:     @m = Mysql.init
86:     assert_equal(@m, @m.connect(@host, @user, @pass, @db, @port, @sock, @flag))
87:     @m.close
88:   end

[Source]

    # File test.rb, line 42
42:   def test_escape_string()
43:     assert_equal("abc\\'def\\\"ghi\\0jkl%mno", Mysql.escape_string("abc'def\"ghi\0jkl%mno"))
44:   end

[Source]

    # File test.rb, line 50
50:   def test_get_client_info()
51:     assert_match(/^\d.\d+.\d+$/, Mysql.get_client_info())
52:   end

[Source]

    # File test.rb, line 22
22:   def test_init()
23:     assert_nothing_raised{@m = Mysql.init}
24:     assert_nothing_raised{@m.close}
25:   end

[Source]

    # File test.rb, line 37
37:   def test_new()
38:     assert_nothing_raised{@m = Mysql.new(@host, @user, @pass, @db, @port, @sock, @flag)}
39:     assert_nothing_raised{@m.close}
40:   end

[Source]

    # File test.rb, line 58
58:   def test_options()
59:     @m = Mysql.init
60:     assert_equal(@m, @m.options(Mysql::INIT_COMMAND, "SET AUTOCOMMIT=0"))
61:     assert_equal(@m, @m.options(Mysql::OPT_COMPRESS))
62:     assert_equal(@m, @m.options(Mysql::OPT_CONNECT_TIMEOUT, 10))
63:     assert_equal(@m, @m.options(Mysql::OPT_LOCAL_INFILE, true))
64: #   assert_equal(@m, @m.options(Mysql::OPT_NAMED_PIPE))
65: #   assert_equal(@m, @m.options(Mysql::OPT_PROTOCOL, 1))
66:     assert_equal(@m, @m.options(Mysql::OPT_READ_TIMEOUT, 10))
67:     assert_equal(@m, @m.options(Mysql::OPT_WRITE_TIMEOUT, 10))
68: #   assert_equal(@m, @m.options(Mysql::READ_DEFAULT_FILE, "/tmp/hoge"))
69:     assert_equal(@m, @m.options(Mysql::READ_DEFAULT_GROUP, "test"))
70:     assert_equal(@m, @m.options(Mysql::SECURE_AUTH, true))
71: #   assert_equal(@m, @m.options(Mysql::SET_CHARSET_DIR, "??"))
72:     assert_equal(@m, @m.options(Mysql::SET_CHARSET_NAME, "latin1"))
73: #   assert_equal(@m, @m.options(Mysql::SHARED_MEMORY_BASE_NAME, "xxx"))
74:     assert_equal(@m, @m.connect(@host, @user, @pass, @db, @port, @sock, @flag))
75:     @m.close
76:   end

[Source]

    # File test.rb, line 46
46:   def test_quote()
47:     assert_equal("abc\\'def\\\"ghi\\0jkl%mno", Mysql.quote("abc'def\"ghi\0jkl%mno"))
48:   end

[Source]

    # File test.rb, line 27
27:   def test_real_connect()
28:     assert_nothing_raised{@m = Mysql.real_connect(@host, @user, @pass, @db, @port, @sock, @flag)}
29:     assert_nothing_raised{@m.close}
30:   end

[Source]

    # File test.rb, line 78
78:   def test_real_connect2()
79:     @m = Mysql.init
80:     assert_equal(@m, @m.real_connect(@host, @user, @pass, @db, @port, @sock, @flag))
81:     @m.close
82:   end

[Source]

    # File test.rb, line 18
18:   def test_version()
19:     assert_equal(20603, Mysql::VERSION)
20:   end

[Validate]