Permalink
Browse files

Bug corrections in types

  • Loading branch information...
1 parent ff4283f commit 4ba8b6a3638cddf52e5d3914fb2ef942638dc3b4 @glejeune committed Jan 29, 2012
Showing with 8 additions and 5 deletions.
  1. +1 −1 lib/graphviz/types/gv_bool.rb
  2. +2 −1 lib/graphviz/types/spline_type.rb
  3. +5 −3 test/test_types.rb
@@ -5,7 +5,7 @@ class BoolException < RuntimeError
#
# For the bool type,
# - TRUE values are represented by "true" or "yes" (case-insensitive), true and any non-zero integer
-# - FALSE values by "false" or "no" (case-insensitive), false and zero.
+# - FALSE values by "false", "no" or empty string (case-insensitive), false and zero.
#
# Example
#
@@ -35,9 +35,10 @@ def check(data)
@is_spline = false
return data
end
+ return nil if data.empty?
+
raise SplineTypeException, "Invalid spline type value"
end
- return nil if data.empty?
def output
return @data.to_s.inspect.gsub( "\\\\", "\\" )
View
@@ -55,11 +55,13 @@ def test_gv_bool
assert_equal false, bool.to_ruby
assert_raise BoolException, "Wrong bool value" do
- GraphViz::Types::GvBool.new("toto")
+ GraphViz::Types::GvBool.new(:toto)
end
- assert_raise BoolException, "Wrong bool value" do
- GraphViz::Types::GvBool.new("")
+ assert_block "Create GvBool with empty string failed." do
+ bool = GraphViz::Types::GvBool.new("")
end
+ assert bool
+ assert_equal false, bool.to_ruby
end
end

0 comments on commit 4ba8b6a

Please sign in to comment.