如何验证一个特定的文本是存在于日志(字符串格式)在swift?



let command =//一些shell命令执行,打印一些终端日志

command.description//这给了我字符串的表示

let textToSearch = "一些字符串值">

//我的方法let status = command.description. contains (textToSearch)

XCTAssert(status, "The Text is not present!")//失败

let status2 = command.description.range(of: textToSearch) != nil

XCTAssert(status, "The Text is not present!")//失败

let command = Foo()
let description = command.description
let textToSearch = "some string value"
let status = description.localizedLowercase.contains(textToSearch.localizedLowercase)
XCTAssertTrue(status, "The Text is not present!")

相关内容

  • 没有找到相关文章

最新更新