Debian Codegraph @

example/mail/parser_test.go

raw symbols SCIP
1 package mailscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.24 testing/"
5
6 "github.com/goccmack/gocc/example/mail/lexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/"
7 "github.com/goccmack/gocc/example/mail/tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/"
8 )
9
10 var testData1scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/testData1. = map[string]bool{
11 "[email protected]": true,
12 "@google.com": false,
13 `"quoted string"@mymail.com`: true,
14 `"unclosed [email protected]`: false,
15 }
16
17 func Test1scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/Test1().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
18 for input, ok := range testData1scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/testData1. {
19 l := lexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/.NewLexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/NewLexer().([]byte(input))
20 tok := l.Scanscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/Lexer#Scan().()
21 switch {
22 case tok.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/Token#Type. == tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/.INVALIDscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/INVALID.:
23 if ok {
24 t.Errorfscip-go gomod github.com/golang/go/src go1.24 testing/common#Errorf().("%s", input)
25 }
26 case tok.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/Token#Type. == tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/.TokMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/TokMap..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/TokenMap#Type().("addrspec"):
27 if !ok {
28 t.Errorfscip-go gomod github.com/golang/go/src go1.24 testing/common#Errorf().("%s", input)
29 }
30 default:
31 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("This must not happen")
32 }
33 }
34 }
35
36 var checkData2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/checkData2. = []string{
37 "[email protected]",
38 "[email protected]",
39 "[email protected]",
40 }
41
42 var testData2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/testData2. = `
43 [email protected]
44 [email protected]
45 [email protected]
46 `
47
48 func Test2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/Test2().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
49 l := lexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/.NewLexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/NewLexer().([]byte(testData2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/testData2.))
50 num := 0
51 for tok := l.Scanscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/Lexer#Scan().(); tok.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/Token#Type. == tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/.TokMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/TokMap..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/TokenMap#Type().("addrspec"); tok = l.Scanscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/lexer`/Lexer#Scan().() {
52 if string(tok.Litscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/Token#Lit.) != checkData2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/checkData2.[num] {
53 t.Errorfscip-go gomod github.com/golang/go/src go1.24 testing/common#Errorf().("%s != %s", string(tok.Litscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail/token`/Token#Lit.), checkData2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/checkData2.[num])
54 }
55 num++
56 }
57 if num != len(checkData2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/mail`/checkData2.) {
58 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("%d addresses parsed", num)
59 }
60 }