summaryrefslogtreecommitdiff
path: root/test/yaml
diff options
context:
space:
mode:
Diffstat (limited to 'test/yaml')
-rw-r--r--test/yaml/test_yaml.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb
index cdd678cf81..642ebc558f 100644
--- a/test/yaml/test_yaml.rb
+++ b/test/yaml/test_yaml.rb
@@ -1051,6 +1051,28 @@ EOY
)
end
+ #
+ # Test of Ranges
+ #
+ def test_ranges
+
+ # Simple numeric
+ assert_to_yaml( 1..3, <<EOY )
+--- !ruby/range 1..3
+EOY
+
+ # Simple alphabetic
+ assert_to_yaml( 'a'..'z', <<EOY )
+--- !ruby/range a..z
+EOY
+
+ # Float
+ assert_to_yaml( 10.5...30.3, <<EOY )
+--- !ruby/range 10.5...30.3
+EOY
+
+ end
+
def test_ruby_struct
# Ruby structures
book_struct = Struct::new( "BookStruct", :author, :title, :year, :isbn )
@@ -1160,6 +1182,20 @@ EOY
end
#
+ # Test Time.now cycle
+ #
+ def test_time_now_cycle
+ #
+ # From Minero Aoki [ruby-core:2305]
+ #
+ require 'yaml'
+ t = Time.now
+ 5.times do
+ assert_equals( t, YAML.load( YAML.dump( t ) ) )
+ end
+ end
+
+ #
# Circular references
#
def test_circular_references