mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-18 20:43:23 -05:00
Merged config and app packages into one called caddy. Abstracted away caddy startup functionality making it easier to embed Caddy in any Go application and use it as a library. Graceful restart (should) now ensure child starts properly. Now piping a gob bundle to child process so that the child can match up inherited listeners to server address. Much cleanup still to do.
23 lines
456 B
Go
23 lines
456 B
Go
package parse
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestAllTokens(t *testing.T) {
|
|
input := strings.NewReader("a b c\nd e")
|
|
expected := []string{"a", "b", "c", "d", "e"}
|
|
tokens := allTokens(input)
|
|
|
|
if len(tokens) != len(expected) {
|
|
t.Fatalf("Expected %d tokens, got %d", len(expected), len(tokens))
|
|
}
|
|
|
|
for i, val := range expected {
|
|
if tokens[i].text != val {
|
|
t.Errorf("Token %d should be '%s' but was '%s'", i, val, tokens[i].text)
|
|
}
|
|
}
|
|
}
|