(t *testing.T)
| 419 | } |
| 420 | |
| 421 | func TestHasExtension(t *testing.T) { |
| 422 | info := ast.NewSourceInfo(common.NewStringSource("true", "test-only")) |
| 423 | info.AddExtension(ast.NewExtension("json_name", ast.NewExtensionVersion(1, 1), ast.ComponentRuntime)) |
| 424 | if !info.HasExtension("json_name", ast.NewExtensionVersion(1, 0)) { |
| 425 | t.Error("info.HasExtension('json_name', 1.0) returned false for v1.1") |
| 426 | } |
| 427 | if info.HasExtension("json_name", ast.NewExtensionVersion(2, 1)) { |
| 428 | t.Error("info.HasExtension() returned true for v2.1 when v1.1 configured") |
| 429 | } |
| 430 | if info.HasExtension("unrelated", ast.NewExtensionVersion(0, 0)) { |
| 431 | t.Error("info.HasExtension() returned true for unrelated extensions not set on AST") |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | func mockRelativeSource(t testing.TB, text string, lineOffsets []int32, baseLocation common.Location) common.Source { |
| 436 | t.Helper() |
nothing calls this directly
no test coverage detected