(t *testing.T)
| 886 | } |
| 887 | |
| 888 | func TestRejectAnonymousImportBlock(t *testing.T) { |
| 889 | p := testParser(` |
| 890 | (site) { |
| 891 | http://{args[0]} https://{args[0]} { |
| 892 | {block} |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | import site test.domain { |
| 897 | { |
| 898 | header_up Host {host} |
| 899 | header_up X-Real-IP {remote_host} |
| 900 | } |
| 901 | } |
| 902 | `) |
| 903 | _, err := p.parseAll() |
| 904 | if err == nil { |
| 905 | t.Fatal("Expected an error, but got nil") |
| 906 | } |
| 907 | expected := "anonymous blocks are not supported" |
| 908 | if !strings.HasPrefix(err.Error(), "anonymous blocks are not supported") { |
| 909 | t.Errorf("Expected error to start with '%s' but got '%v'", expected, err) |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | func TestAcceptSiteImportWithBraces(t *testing.T) { |
| 914 | p := testParser(` |
nothing calls this directly
no test coverage detected