示例#1
0
	})
	Describe("Bool()", func() {
		It("Should convert values to boolean", func() {
			result := opts.Bool("bool")
			Expect(log.GetEntry()).To(Equal(""))
			Expect(result).To(Equal(true))
		})
		It("Should return default value if key doesn't exist", func() {
			result := opts.Bool("none")
			Expect(result).To(Equal(false))
		})
	})
	Describe("String()", func() {
		It("Should return values as string", func() {
			result := opts.String("string")
			Expect(log.GetEntry()).To(Equal(""))
			Expect(result).To(Equal("one"))
		})
		It("Should return default value if key doesn't exist", func() {
			result := opts.String("none")
			Expect(result).To(Equal(""))
		})
	})
	Describe("NoArgs()", func() {
		It("Should return true if no arguments on the command line", func() {
			parser := args.NewParser()
			parser.AddOption("--power-level").IsInt().Default("1")

			opt, err := parser.ParseArgs(nil)
			Expect(err).To(BeNil())