diff --git a/spec/fixtures/input_ucl_invalid.conf b/spec/fixtures/input_ucl_invalid.conf new file mode 100644 index 0000000..1d869b6 --- /dev/null +++ b/spec/fixtures/input_ucl_invalid.conf @@ -0,0 +1,7 @@ +string: "bar, +true = true +false = false +nil: null +integer 1864 +double 23.42 +time: 10s diff --git a/spec/ucl/decoder_spec.cr b/spec/ucl/decoder_spec.cr index d2aab87..b7c9d1d 100644 --- a/spec/ucl/decoder_spec.cr +++ b/spec/ucl/decoder_spec.cr @@ -70,5 +70,12 @@ describe UCL::Decoder do input_ucl_conf = File.read("spec/fixtures/input_ucl.conf") UCL::Decoder.decode(input_ucl_conf).should eq(OUTPUT_OBJECT) end + + it "should raise error on invalid UCL conf" do + input_ucl_conf = File.read("spec/fixtures/input_ucl_invalid.conf") + expect_raises(UCL::Error::DecoderError) do + UCL::Decoder.decode(input_ucl_conf) + end + end end end