Testing by Assertions
String Check
Check whether a string contains required text.
String Check
string_check.lua
local text =
local found = string.find(text, "trace") ~= nil
local status = "fail"
if found then
status = "pass"
end
print("text=" .. text)
print("status=" .. status)
local text =
local found = string.find(text, "trace") ~= nil
local status = "fail"
if found then
status = "pass"
end
print("text=" .. text)
print("status=" .. status)
local text =
local found = string.find(text, "trace") ~= nil
local status = "fail"
if found then
status = "pass"
end
print("text=" .. text)
print("status=" .. status)
substring assertion
`string.find` returns a position when the required text is present and `nil` when it is missing.