From 691e54dfc6c8afcd8284556f8499d8a8c05b15ac Mon Sep 17 00:00:00 2001 From: myk002 Date: Tue, 24 Aug 2021 21:06:12 -0700 Subject: [PATCH] rename expect.find to expect.str_find --- library/lua/test_util/expect.lua | 2 +- test/library/test_util/expect_unit.lua | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/lua/test_util/expect.lua b/library/lua/test_util/expect.lua index 093fb7243..19a7b39e0 100644 --- a/library/lua/test_util/expect.lua +++ b/library/lua/test_util/expect.lua @@ -47,7 +47,7 @@ function expect.ge(a, b, comment) return a >= b, comment, ('%s < %s'):format(a, b) end -function expect.find(pattern, str_to_match, comment) +function expect.str_find(pattern, str_to_match, comment) if type(str_to_match) ~= 'string' then return false, comment, 'expected string, got ' .. type(str_to_match) end diff --git a/test/library/test_util/expect_unit.lua b/test/library/test_util/expect_unit.lua index 8b96cd0bc..fd9f9b1c0 100644 --- a/test/library/test_util/expect_unit.lua +++ b/test/library/test_util/expect_unit.lua @@ -1,18 +1,18 @@ local expect_raw = require('test_util.expect') function test.find() - expect.true_(expect_raw.find('a ', 'a str', 'a comment')) + expect.true_(expect_raw.str_find('a ', 'a str', 'a comment')) - local ok, comment, msg = expect_raw.find('ab', '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.find('pattern', nil) + ok, _, msg = expect_raw.str_find('pattern', nil) expect.false_(ok) expect.eq('expected string, got nil', msg) - ok, _, msg = expect_raw.find('pattern', {}) + ok, _, msg = expect_raw.str_find('pattern', {}) expect.false_(ok) expect.eq('expected string, got table', msg) end