| 61 | using ::testing::ValuesIn; |
| 62 | |
| 63 | TEST(StringsCheckerLibrary, SmokeTest) { |
| 64 | ASSERT_OK_AND_ASSIGN( |
| 65 | auto builder, NewCompilerBuilder(internal::GetTestingDescriptorPool())); |
| 66 | ASSERT_THAT(builder->AddLibrary(StringsCheckerLibrary()), IsOk()); |
| 67 | ASSERT_THAT(builder->AddLibrary(StandardCheckerLibrary()), IsOk()); |
| 68 | ASSERT_THAT(builder->GetCheckerBuilder().AddVariable( |
| 69 | MakeVariableDecl("foo", StringType())), |
| 70 | IsOk()); |
| 71 | |
| 72 | ASSERT_OK_AND_ASSIGN(auto compiler, std::move(*builder).Build()); |
| 73 | |
| 74 | ASSERT_OK_AND_ASSIGN( |
| 75 | ValidationResult result, |
| 76 | compiler->Compile("foo.replace('he', 'we', 1) == 'wello hello'")); |
| 77 | ASSERT_TRUE(result.IsValid()); |
| 78 | |
| 79 | EXPECT_EQ(test::FormatBaselineAst(*result.GetAst()), |
| 80 | R"(_==_( |
| 81 | foo~string^foo.replace( |
| 82 | "he"~string, |
| 83 | "we"~string, |
| 84 | 1~int |
| 85 | )~string^string_replace_string_string_int, |
| 86 | "wello hello"~string |
| 87 | )~bool^equals)"); |
| 88 | } |
| 89 | |
| 90 | TEST(StringsExtTest, MaxPrecisionOption) { |
| 91 | StringsExtensionOptions extension_options; |
nothing calls this directly
no test coverage detected