Sha256: 3b78624fcfbde284a91634898e4f10cc284c401c73eb6cdeb7b351caeeb2e658
Contents?: true
Size: 1.07 KB
Versions: 15
Compression:
Stored size: 1.07 KB
Contents
require 'helper' module Syck class TestString < Test::Unit::TestCase def test_binary_string_null string = "\x00" yml = Syck.dump string assert_match(/binary/, yml) assert_equal string, Syck.load(yml) end def test_binary_string string = binary_string yml = Syck.dump string assert_match(/binary/, yml) assert_equal string, Syck.load(yml) end def test_non_binary_string string = binary_string(0.29) yml = Syck.dump string assert_not_match(/binary/, yml) assert_equal string, Syck.load(yml) end def test_string_with_ivars food = "is delicious" ivar = "on rock and roll" food.instance_variable_set(:@we_built_this_city, ivar) str = Syck.load Syck.dump food assert_equal ivar, food.instance_variable_get(:@we_built_this_city) end def binary_string percentage = 0.31, length = 100 string = '' (percentage * length).to_i.times do |i| string << "\b" end string << 'a' * (length - string.length) string end end end
Version data entries
15 entries across 15 versions & 2 rubygems