test/test_inifile.rb in o-inifile-4.0.0 vs test/test_inifile.rb in o-inifile-4.0.1

- old
+ new

@@ -60,30 +60,38 @@ end def test_clone clone = @ini_file.clone assert_equal @ini_file, clone - assert !clone.tainted? + if RUBY_VERSION < '2.7' + assert !clone.tainted? + end assert !clone.frozen? # the clone should be completely independent of the original clone['new_section']['one'] = 1 assert_not_equal @ini_file, clone - # the tainted state is copied to clones - @ini_file.taint - assert @ini_file.tainted? + if RUBY_VERSION < '2.7' + # the tainted state is copied to clones + @ini_file.taint + assert @ini_file.tainted? + end - clone = @ini_file.clone - assert clone.tainted? + if RUBY_VERSION < '2.7' + clone = @ini_file.clone + assert clone.tainted? + end # the frozen state is also copied to clones @ini_file.freeze assert @ini_file.frozen? clone = @ini_file.clone - assert clone.tainted? + if RUBY_VERSION < '2.7' + assert clone.tainted? + end assert clone.frozen? end def test_delete_section assert_nil @ini_file.delete_section('section_nil') @@ -96,30 +104,38 @@ end def test_dup dup = @ini_file.dup assert_equal @ini_file, dup - assert !dup.tainted? + if RUBY_VERSION < '2.7' + assert !dup.tainted? + end assert !dup.frozen? # the duplicate should be completely independent of the original dup['new_section']['one'] = 1 assert_not_equal @ini_file, dup - # the tainted state is copied to duplicates - @ini_file.taint - assert @ini_file.tainted? + if RUBY_VERSION < '2.7' + # the tainted state is copied to duplicates + @ini_file.taint + assert @ini_file.tainted? + end - dup = @ini_file.dup - assert dup.tainted? + if RUBY_VERSION < '2.7' + dup = @ini_file.dup + assert dup.tainted? + end # the frozen state, however, is not @ini_file.freeze assert @ini_file.frozen? dup = @ini_file.dup - assert dup.tainted? + if RUBY_VERSION < '2.7' + assert dup.tainted? + end assert !dup.frozen? end def test_each ary = [] @@ -330,20 +346,22 @@ ini_file = IniFile.new(:filename => 'temp.ini') assert_equal [], ini_file.sections end - def test_taint - assert_equal false, @ini_file.tainted? - @ini_file.each_section do |s| - assert_equal false, @ini_file[s].tainted? - end + if RUBY_VERSION < '2.7' + def test_taint + assert_equal false, @ini_file.tainted? + @ini_file.each_section do |s| + assert_equal false, @ini_file[s].tainted? + end - @ini_file.taint + @ini_file.taint - assert_equal true, @ini_file.tainted? - @ini_file.each_section do |s| - assert_equal true, @ini_file[s].tainted? + assert_equal true, @ini_file.tainted? + @ini_file.each_section do |s| + assert_equal true, @ini_file[s].tainted? + end end end def test_write tmp = 'test/data/temp.ini'