In Files

Parent

TC_Mysql

Public Instance Methods

setup() click to toggle 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
teardown() click to toggle source
    # File test.rb, line 15
15:   def teardown()
16:   end
test_client_info() click to toggle source
    # File test.rb, line 54
54:   def test_client_info()
55:     assert_match(/^\d.\d+.\d+[a-z]?(-.*)?$/, Mysql.client_info())
56:   end
test_connect() click to toggle 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
test_connect2() click to toggle source
    # File test.rb, line 88
88:   def test_connect2()
89:     @m = Mysql.init
90:     assert_equal(@m, @m.connect(@host, @user, @pass, @db, @port, @sock, @flag))
91:     @m.close
92:   end
test_escape_string() click to toggle 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\00jjkl%mno"))
44:   end
test_get_client_info() click to toggle source
    # File test.rb, line 50
50:   def test_get_client_info()
51:     assert_match(/^\d.\d+.\d+[a-z]?(-.*)?$/, Mysql.get_client_info())
52:   end
test_init() click to toggle 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
test_new() click to toggle 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
test_options() click to toggle 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::GUESS_CONNECTION)) if defined? Mysql::GUESS_CONNECTION
64:     assert_equal(@m, @m.options(Mysql::OPT_LOCAL_INFILE, true))
65: #   assert_equal(@m, @m.options(Mysql::OPT_NAMED_PIPE))
66: #   assert_equal(@m, @m.options(Mysql::OPT_PROTOCOL, 1))
67:     assert_equal(@m, @m.options(Mysql::OPT_READ_TIMEOUT, 10)) if defined? Mysql::OPT_READ_TIMEOUT
68:     assert_equal(@m, @m.options(Mysql::OPT_USE_EMBEDDED_CONNECTION)) if defined? Mysql::OPT_USE_EMBEDDED_CONNECTION
69:     assert_equal(@m, @m.options(Mysql::OPT_USE_REMOTE_CONNECTION)) if defined? Mysql::OPT_USE_REMOTE_CONNECTION
70:     assert_equal(@m, @m.options(Mysql::OPT_WRITE_TIMEOUT, 10)) if defined? Mysql::OPT_WRITE_TIMEOUT
71: #   assert_equal(@m, @m.options(Mysql::READ_DEFAULT_FILE, "/tmp/hoge"))
72:     assert_equal(@m, @m.options(Mysql::READ_DEFAULT_GROUP, "test"))
73:     assert_equal(@m, @m.options(Mysql::SECURE_AUTH, true)) if defined? Mysql::SECURE_AUTH
74: #   assert_equal(@m, @m.options(Mysql::SET_CHARSET_DIR, "??"))
75:     assert_equal(@m, @m.options(Mysql::SET_CHARSET_NAME, "latin1"))
76:     assert_equal(@m, @m.options(Mysql::SET_CLIENT_IP, "127.0.0.1")) if defined? Mysql::SET_CLIENT_IP
77: #   assert_equal(@m, @m.options(Mysql::SHARED_MEMORY_BASE_NAME, "xxx"))
78:     assert_equal(@m, @m.connect(@host, @user, @pass, @db, @port, @sock, @flag))
79:     @m.close
80:   end
test_quote() click to toggle source
    # File test.rb, line 46
46:   def test_quote()
47:     assert_equal("abc\\'def\\\"ghi\\0jkl%mno", Mysql.quote("abc'def\"ghi\00jjkl%mno"))
48:   end
test_real_connect() click to toggle 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
test_real_connect2() click to toggle source
    # File test.rb, line 82
82:   def test_real_connect2()
83:     @m = Mysql.init
84:     assert_equal(@m, @m.real_connect(@host, @user, @pass, @db, @port, @sock, @flag))
85:     @m.close
86:   end
test_version() click to toggle source
    # File test.rb, line 18
18:   def test_version()
19:     assert_equal(20802, Mysql::VERSION)
20:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.