mirror of
https://github.com/rclone/rclone.git
synced 2025-12-23 03:33:28 +00:00
vendor: update all dependencies to latest versions
This commit is contained in:
49
vendor/github.com/go-ini/ini/parser_test.go
generated
vendored
49
vendor/github.com/go-ini/ini/parser_test.go
generated
vendored
@@ -12,31 +12,66 @@
|
||||
// License for the specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package ini
|
||||
package ini_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
func Test_BOM(t *testing.T) {
|
||||
func TestBOM(t *testing.T) {
|
||||
Convey("Test handling BOM", t, func() {
|
||||
Convey("UTF-8-BOM", func() {
|
||||
cfg, err := Load("testdata/UTF-8-BOM.ini")
|
||||
f, err := ini.Load("testdata/UTF-8-BOM.ini")
|
||||
So(err, ShouldBeNil)
|
||||
So(cfg, ShouldNotBeNil)
|
||||
So(f, ShouldNotBeNil)
|
||||
|
||||
So(cfg.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io")
|
||||
So(f.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io")
|
||||
})
|
||||
|
||||
Convey("UTF-16-LE-BOM", func() {
|
||||
cfg, err := Load("testdata/UTF-16-LE-BOM.ini")
|
||||
f, err := ini.Load("testdata/UTF-16-LE-BOM.ini")
|
||||
So(err, ShouldBeNil)
|
||||
So(cfg, ShouldNotBeNil)
|
||||
So(f, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("UTF-16-BE-BOM", func() {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestBadLoad(t *testing.T) {
|
||||
Convey("Load with bad data", t, func() {
|
||||
Convey("Bad section name", func() {
|
||||
_, err := ini.Load([]byte("[]"))
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, err = ini.Load([]byte("["))
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("Bad keys", func() {
|
||||
_, err := ini.Load([]byte(`"""name`))
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, err = ini.Load([]byte(`"""name"""`))
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, err = ini.Load([]byte(`""=1`))
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, err = ini.Load([]byte(`=`))
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, err = ini.Load([]byte(`name`))
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("Bad values", func() {
|
||||
_, err := ini.Load([]byte(`name="""Unknwon`))
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user