예제 #1
0
			fc.NewIntFlagWithDefault("i", "i2", "setting new int flag", 10)
			fc.Parse()
			Expect(fc.IsSet("i")).To(BeTrue())
			Expect(fc.IsSet("i2")).To(BeTrue())
			Expect(fc.Int("i")).To(Equal(10))
			Expect(fc.Int("i2")).To(Equal(10))
		})
	})

	Describe("NewFloat64Flag()", func() {
		It("init the flag context with a new float64 flagset", func() {
			fc.Parse("-f", "5.5")
			Expect(fc.IsSet("f")).To(BeFalse())
			Expect(fc.Float64("f")).To(Equal(float64(0)))

			fc.NewFloat64Flag("f", "f2", "setting new flag")
			fc.Parse("-f", "5.5")
			Expect(fc.IsSet("f")).To(BeTrue())
			Expect(fc.IsSet("f2")).To(BeTrue())
			Expect(fc.Float64("f")).To(Equal(5.5))
			Expect(fc.Float64("f2")).To(Equal(5.5))
		})
	})

	Describe("NewFloat64FlagWithDefault()", func() {
		It("init the flag context with a new Float64 flagset with default value", func() {
			fc.Parse()
			Expect(fc.IsSet("i")).To(BeFalse())
			Expect(fc.Float64("i")).To(Equal(float64(0)))

			fc.NewFloat64FlagWithDefault("i", "i2", "setting new flag", 5.5)