You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package lexer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_LexerSimple(t *testing.T) {
|
|
|
|
tt := []string{
|
|
|
|
"[[",
|
|
|
|
"]]",
|
|
|
|
"[[foo]]",
|
|
|
|
"[[foo]]",
|
|
|
|
"[[foo|bar]]",
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range tt {
|
|
|
|
t.Run(tc, func(t *testing.T) {
|
|
|
|
t.Logf("checking %q", tc)
|
|
|
|
_, tokens := Lex(tc)
|
|
|
|
for tok := range tokens {
|
|
|
|
t.Logf("found token: %#v", tok)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
func Test_LexerFull(t *testing.T) {
|
|
|
|
tt := []string{
|
|
|
|
`[[Regular Link]]`,
|
|
|
|
`![[Transcluded Link]]`,
|
|
|
|
`[[Regular Link|Alias]]`,
|
|
|
|
`[[Regular Link#Subsection of page]]`,
|
|
|
|
`[[Regular Link^link to block]]`,
|
|
|
|
`[[Regular Link#Subsection of page|Alias]]`,
|
|
|
|
`[[Regular Link^link to block|Alias]]`,
|
|
|
|
`[[Regular Link\|Alias]]`,
|
|
|
|
`[[Regular Link^link to block\|Alias]]`,
|
|
|
|
`[[Regular Link#Subsection of page\|Alias]]`,
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range tt {
|
|
|
|
t.Run(tc, func(t *testing.T) {
|
|
|
|
t.Fail()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|