(t *testing.T)
| 429 | } |
| 430 | |
| 431 | func TestHasExtension(t *testing.T) { |
| 432 | info := ast.NewSourceInfo(common.NewStringSource("true", "test-only")) |
| 433 | info.AddExtension(ast.NewExtension("json_name", ast.NewExtensionVersion(1, 1), ast.ComponentRuntime)) |
| 434 | if !info.HasExtension("json_name", ast.NewExtensionVersion(1, 0)) { |
| 435 | t.Error("info.HasExtension('json_name', 1.0) returned false for v1.1") |
| 436 | } |
| 437 | if info.HasExtension("json_name", ast.NewExtensionVersion(2, 1)) { |
| 438 | t.Error("info.HasExtension() returned true for v2.1 when v1.1 configured") |
| 439 | } |
| 440 | if info.HasExtension("unrelated", ast.NewExtensionVersion(0, 0)) { |
| 441 | t.Error("info.HasExtension() returned true for unrelated extensions not set on AST") |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | func mockRelativeSource(t testing.TB, text string, lineOffsets []int32, baseLocation common.Location) common.Source { |
| 446 | t.Helper() |
nothing calls this directly
no test coverage detected