* test/syck/*: Moved test/yaml to test/syck since it's actually

testing the syck YAML engine.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2010-04-11 00:37:42 +00:00
parent 711b5f35ac
commit a5f05e7ee9
17 changed files with 95 additions and 86 deletions

View File

@ -1,3 +1,8 @@
Sun Apr 11 09:31:39 2010 Aaron Patterson <aaron@tenderlovemaking.com>
* test/syck/*: Moved test/yaml to test/syck since it's actually
testing the syck YAML engine.
Sun Apr 11 08:56:44 2010 NARUSE, Yui <naruse@ruby-lang.org>
* lib/rdoc/rdoc.rb (setup_output_dir): compare by Time#to_i.

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestArray < Test::Unit::TestCase
def setup
@list = [{ :a => 'b' }, 'foo']

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
###
# Test booleans from YAML spec:
# http://yaml.org/type/bool.html

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestClass < Test::Unit::TestCase
def test_to_yaml
assert_raises(::TypeError) do

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestException < Test::Unit::TestCase
class Wups < Exception
attr_reader :foo, :bar

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestHash < Test::Unit::TestCase
def setup
@hash = { :a => 'b' }

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
###
# Test null from YAML spec:
# http://yaml.org/type/null.html

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestOmap < Test::Unit::TestCase
def test_keys
map = YAML::Omap.new

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestSet < Test::Unit::TestCase
def setup
@set = YAML::Set.new

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestString < Test::Unit::TestCase
def test_binary_string_null
string = "\x00"

View File

@ -9,7 +9,7 @@ class StructWithIvar < Struct.new(:foo)
end
end
module YAML
module Syck
class TestStruct < MiniTest::Unit::TestCase
def test_roundtrip
thing = StructWithIvar.new('bar')

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestSymbol < Test::Unit::TestCase
def test_to_yaml
assert_equal :a, YAML.load(:a.to_yaml)

View File

@ -11,6 +11,7 @@ module YAML_Tests
StructTest = Struct::new( :c )
end
module Syck
class YAML_Unit_Tests < Test::Unit::TestCase
#
# Convert between YAML and the object to verify correct parsing and
@ -1316,6 +1317,7 @@ EOY
# '[ruby-core:13735]'
end
end
end
if $0 == __FILE__
suite = Test::Unit::TestSuite.new('YAML')

View File

@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
module YAML
module Syck
class TestYamlProperties < Test::Unit::TestCase
class Foo
attr_reader :a, :b, :c

View File

@ -0,0 +1,76 @@
require 'test/unit'
require 'syck/store'
module Syck
class YAMLStoreTest < Test::Unit::TestCase
def setup
@yamlstore_file = "yamlstore.tmp.#{Process.pid}"
@yamlstore = YAML::Store.new(@yamlstore_file)
end
def teardown
File.unlink(@yamlstore_file) rescue nil
end
def test_opening_new_file_in_readonly_mode_should_result_in_empty_values
@yamlstore.transaction(true) do
assert_nil @yamlstore[:foo]
assert_nil @yamlstore[:bar]
end
end
def test_opening_new_file_in_readwrite_mode_should_result_in_empty_values
@yamlstore.transaction do
assert_nil @yamlstore[:foo]
assert_nil @yamlstore[:bar]
end
end
def test_data_should_be_loaded_correctly_when_in_readonly_mode
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
end
@yamlstore.transaction(true) do
assert_equal "bar", @yamlstore[:foo]
end
end
def test_data_should_be_loaded_correctly_when_in_readwrite_mode
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
end
@yamlstore.transaction do
assert_equal "bar", @yamlstore[:foo]
end
end
def test_changes_after_commit_are_discarded
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@yamlstore.commit
@yamlstore[:foo] = "baz"
end
@yamlstore.transaction(true) do
assert_equal "bar", @yamlstore[:foo]
end
end
def test_changes_are_not_written_on_abort
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@yamlstore.abort
end
@yamlstore.transaction(true) do
assert_nil @yamlstore[:foo]
end
end
def test_writing_inside_readonly_transaction_raises_error
assert_raise(PStore::Error) do
@yamlstore.transaction(true) do
@yamlstore[:foo] = "bar"
end
end
end
end
end

View File

@ -1,74 +0,0 @@
require 'test/unit'
require 'syck/store'
class YAMLStoreTest < Test::Unit::TestCase
def setup
@yamlstore_file = "yamlstore.tmp.#{Process.pid}"
@yamlstore = YAML::Store.new(@yamlstore_file)
end
def teardown
File.unlink(@yamlstore_file) rescue nil
end
def test_opening_new_file_in_readonly_mode_should_result_in_empty_values
@yamlstore.transaction(true) do
assert_nil @yamlstore[:foo]
assert_nil @yamlstore[:bar]
end
end
def test_opening_new_file_in_readwrite_mode_should_result_in_empty_values
@yamlstore.transaction do
assert_nil @yamlstore[:foo]
assert_nil @yamlstore[:bar]
end
end
def test_data_should_be_loaded_correctly_when_in_readonly_mode
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
end
@yamlstore.transaction(true) do
assert_equal "bar", @yamlstore[:foo]
end
end
def test_data_should_be_loaded_correctly_when_in_readwrite_mode
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
end
@yamlstore.transaction do
assert_equal "bar", @yamlstore[:foo]
end
end
def test_changes_after_commit_are_discarded
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@yamlstore.commit
@yamlstore[:foo] = "baz"
end
@yamlstore.transaction(true) do
assert_equal "bar", @yamlstore[:foo]
end
end
def test_changes_are_not_written_on_abort
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@yamlstore.abort
end
@yamlstore.transaction(true) do
assert_nil @yamlstore[:foo]
end
end
def test_writing_inside_readonly_transaction_raises_error
assert_raise(PStore::Error) do
@yamlstore.transaction(true) do
@yamlstore[:foo] = "bar"
end
end
end
end