summaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-02-24 09:20:15 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-02-24 09:20:15 -0500
commit01d9263981c76c7b582b77a22a8716794ac4a13a (patch)
tree9b82aeb313f7817e9f8d60c8b8a95cef8dcd5814 /Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go
parentc0677c190d8d8c0350c69156ab6518120a2af1d1 (diff)
parenteffbfff1ef7c227fd4d9f3eb0fb6a3ba8d753f4c (diff)
downloadchat-01d9263981c76c7b582b77a22a8716794ac4a13a.tar.gz
chat-01d9263981c76c7b582b77a22a8716794ac4a13a.tar.bz2
chat-01d9263981c76c7b582b77a22a8716794ac4a13a.zip
Merge pull request #2232 from mattermost/update-golang-deps
Updating golang dependancies (godep)
Diffstat (limited to 'Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go')
-rw-r--r--Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go89
1 files changed, 0 insertions, 89 deletions
diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go
deleted file mode 100644
index 06a4d05ea..000000000
--- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go
+++ /dev/null
@@ -1,89 +0,0 @@
-package ini
-
-import (
- "reflect"
- "strings"
- "testing"
-)
-
-func TestLoad(t *testing.T) {
- src := `
- # Comments are ignored
-
- herp = derp
-
- [foo]
- hello=world
- whitespace should = not matter
- ; sneaky semicolon-style comment
- multiple = equals = signs
-
- [bar]
- this = that`
-
- file, err := Load(strings.NewReader(src))
- if err != nil {
- t.Fatal(err)
- }
- check := func(section, key, expect string) {
- if value, _ := file.Get(section, key); value != expect {
- t.Errorf("Get(%q, %q): expected %q, got %q", section, key, expect, value)
- }
- }
-
- check("", "herp", "derp")
- check("foo", "hello", "world")
- check("foo", "whitespace should", "not matter")
- check("foo", "multiple", "equals = signs")
- check("bar", "this", "that")
-}
-
-func TestSyntaxError(t *testing.T) {
- src := `
- # Line 2
- [foo]
- bar = baz
- # Here's an error on line 6:
- wut?
- herp = derp`
- _, err := Load(strings.NewReader(src))
- t.Logf("%T: %v", err, err)
- if err == nil {
- t.Fatal("expected an error, got nil")
- }
- syntaxErr, ok := err.(ErrSyntax)
- if !ok {
- t.Fatal("expected an error of type ErrSyntax")
- }
- if syntaxErr.Line != 6 {
- t.Fatal("incorrect line number")
- }
- if syntaxErr.Source != "wut?" {
- t.Fatal("incorrect source")
- }
-}
-
-func TestDefinedSectionBehaviour(t *testing.T) {
- check := func(src string, expect File) {
- file, err := Load(strings.NewReader(src))
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(file, expect) {
- t.Errorf("expected %v, got %v", expect, file)
- }
- }
- // No sections for an empty file
- check("", File{})
- // Default section only if there are actually values for it
- check("foo=bar", File{"": {"foo": "bar"}})
- // User-defined sections should always be present, even if empty
- check("[a]\n[b]\nfoo=bar", File{
- "a": {},
- "b": {"foo": "bar"},
- })
- check("foo=bar\n[a]\nthis=that", File{
- "": {"foo": "bar"},
- "a": {"this": "that"},
- })
-}