porting all github actions from bluesky-social/indigo to tangled CI
at main 982 B view raw
1package syntax 2 3import ( 4 "bufio" 5 "fmt" 6 "os" 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10) 11 12func TestInteropURIsValid(t *testing.T) { 13 assert := assert.New(t) 14 file, err := os.Open("testdata/uri_syntax_valid.txt") 15 assert.NoError(err) 16 defer file.Close() 17 scanner := bufio.NewScanner(file) 18 for scanner.Scan() { 19 line := scanner.Text() 20 if len(line) == 0 || line[0] == '#' { 21 continue 22 } 23 _, err := ParseURI(line) 24 if err != nil { 25 fmt.Println("GOOD: " + line) 26 } 27 assert.NoError(err) 28 } 29 assert.NoError(scanner.Err()) 30} 31 32func TestInteropURIsInvalid(t *testing.T) { 33 assert := assert.New(t) 34 file, err := os.Open("testdata/uri_syntax_invalid.txt") 35 assert.NoError(err) 36 defer file.Close() 37 scanner := bufio.NewScanner(file) 38 for scanner.Scan() { 39 line := scanner.Text() 40 if len(line) == 0 || line[0] == '#' { 41 continue 42 } 43 _, err := ParseURI(line) 44 if err == nil { 45 fmt.Println("BAD: " + line) 46 } 47 assert.Error(err) 48 } 49 assert.NoError(scanner.Err()) 50}