mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-30 09:41:19 +00:00
41 lines
608 B
Go
41 lines
608 B
Go
|
package rconfig_test
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
|
||
|
. "github.com/Luzifer/rconfig"
|
||
|
|
||
|
. "github.com/onsi/ginkgo"
|
||
|
. "github.com/onsi/gomega"
|
||
|
)
|
||
|
|
||
|
var _ = Describe("Testing os.Args", func() {
|
||
|
type t struct {
|
||
|
A string `default:"a" flag:"a"`
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
err error
|
||
|
cfg t
|
||
|
)
|
||
|
|
||
|
JustBeforeEach(func() {
|
||
|
err = Parse(&cfg)
|
||
|
})
|
||
|
|
||
|
Context("With only valid arguments", func() {
|
||
|
|
||
|
BeforeEach(func() {
|
||
|
cfg = t{}
|
||
|
os.Args = []string{"--a=bar"}
|
||
|
})
|
||
|
|
||
|
It("should not have errored", func() { Expect(err).NotTo(HaveOccurred()) })
|
||
|
It("should have the expected values", func() {
|
||
|
Expect(cfg.A).To(Equal("bar"))
|
||
|
})
|
||
|
|
||
|
})
|
||
|
|
||
|
})
|