|
|
|
@ -1,5 +1,22 @@
|
|
|
|
|
local expect_raw = require('test_util.expect')
|
|
|
|
|
|
|
|
|
|
function test.str_find()
|
|
|
|
|
expect.true_(expect_raw.str_find('a ', 'a str', 'a comment'))
|
|
|
|
|
|
|
|
|
|
local ok, comment, msg = expect_raw.str_find('ab', 'a str', 'a comment')
|
|
|
|
|
expect.false_(ok)
|
|
|
|
|
expect.eq('a comment', comment)
|
|
|
|
|
expect.eq('pattern "ab" not matched in "a str"', msg)
|
|
|
|
|
|
|
|
|
|
ok, _, msg = expect_raw.str_find('pattern', nil)
|
|
|
|
|
expect.false_(ok)
|
|
|
|
|
expect.eq('expected string, got nil', msg)
|
|
|
|
|
|
|
|
|
|
ok, _, msg = expect_raw.str_find('pattern', {})
|
|
|
|
|
expect.false_(ok)
|
|
|
|
|
expect.eq('expected string, got table', msg)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test.table_eq()
|
|
|
|
|
expect.true_(expect_raw.table_eq({}, {}))
|
|
|
|
|
expect.true_(expect_raw.table_eq({'a'}, {'a'}))
|
|
|
|
|