Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
5397eef2
Commit
5397eef2
authored
May 21, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for allTokens
parent
d311345a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
config/parse/parse.go
config/parse/parse.go
+2
-0
config/parse/parse_test.go
config/parse/parse_test.go
+22
-0
No files found.
config/parse/parse.go
View file @
5397eef2
...
@@ -24,4 +24,6 @@ func allTokens(input io.Reader) (tokens []token) {
...
@@ -24,4 +24,6 @@ func allTokens(input io.Reader) (tokens []token) {
return
return
}
}
// Set of directives that are valid (unordered). Populated
// by config package's init function.
var
ValidDirectives
=
make
(
map
[
string
]
struct
{})
var
ValidDirectives
=
make
(
map
[
string
]
struct
{})
config/parse/parse_test.go
0 → 100644
View file @
5397eef2
package
parse
import
(
"strings"
"testing"
)
func
TestAllTokens
(
t
*
testing
.
T
)
{
input
:=
strings
.
NewReader
(
"a b c
\n
d 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
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment