summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/syck/test_array.rb (renamed from test/yaml/test_array.rb)2
-rw-r--r--test/syck/test_boolean.rb (renamed from test/yaml/test_boolean.rb)2
-rw-r--r--test/syck/test_class.rb (renamed from test/yaml/test_class.rb)2
-rw-r--r--test/syck/test_engine_manager.rb (renamed from test/yaml/test_engine_manager.rb)0
-rw-r--r--test/syck/test_exception.rb (renamed from test/yaml/test_exception.rb)2
-rw-r--r--test/syck/test_hash.rb (renamed from test/yaml/test_hash.rb)2
-rw-r--r--test/syck/test_null.rb (renamed from test/yaml/test_null.rb)2
-rw-r--r--test/syck/test_omap.rb (renamed from test/yaml/test_omap.rb)2
-rw-r--r--test/syck/test_set.rb (renamed from test/yaml/test_set.rb)2
-rw-r--r--test/syck/test_string.rb (renamed from test/yaml/test_string.rb)2
-rw-r--r--test/syck/test_struct.rb (renamed from test/yaml/test_struct.rb)2
-rw-r--r--test/syck/test_symbol.rb (renamed from test/yaml/test_symbol.rb)2
-rw-r--r--test/syck/test_yaml.rb (renamed from test/yaml/test_yaml.rb)2
-rw-r--r--test/syck/test_yaml_properties.rb (renamed from test/yaml/test_yaml_properties.rb)2
-rw-r--r--test/syck/test_yamlstore.rb76
-rw-r--r--test/yaml/test_yamlstore.rb74
16 files changed, 90 insertions, 86 deletions
diff --git a/test/yaml/test_array.rb b/test/syck/test_array.rb
index 95ff94b959..7ffa1b404f 100644
--- a/test/yaml/test_array.rb
+++ b/test/syck/test_array.rb
@@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
-module YAML
+module Syck
class TestArray < Test::Unit::TestCase
def setup
@list = [{ :a => 'b' }, 'foo']
diff --git a/test/yaml/test_boolean.rb b/test/syck/test_boolean.rb
index 1c75c3a390..615b0b0c8f 100644
--- a/test/yaml/test_boolean.rb
+++ b/test/syck/test_boolean.rb
@@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
-module YAML
+module Syck
###
# Test booleans from YAML spec:
# http://yaml.org/type/bool.html
diff --git a/test/yaml/test_class.rb b/test/syck/test_class.rb
index 9ea9db3096..803a1f14b4 100644
--- a/test/yaml/test_class.rb
+++ b/test/syck/test_class.rb
@@ -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
diff --git a/test/yaml/test_engine_manager.rb b/test/syck/test_engine_manager.rb
index 529fc49d38..529fc49d38 100644
--- a/test/yaml/test_engine_manager.rb
+++ b/test/syck/test_engine_manager.rb
diff --git a/test/yaml/test_exception.rb b/test/syck/test_exception.rb
index f9354ffe2b..b85cabcd6b 100644
--- a/test/yaml/test_exception.rb
+++ b/test/syck/test_exception.rb
@@ -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
diff --git a/test/yaml/test_hash.rb b/test/syck/test_hash.rb
index 18a7e2533a..0690f77ec3 100644
--- a/test/yaml/test_hash.rb
+++ b/test/syck/test_hash.rb
@@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
-module YAML
+module Syck
class TestHash < Test::Unit::TestCase
def setup
@hash = { :a => 'b' }
diff --git a/test/yaml/test_null.rb b/test/syck/test_null.rb
index e6b29550e4..b38bf50fba 100644
--- a/test/yaml/test_null.rb
+++ b/test/syck/test_null.rb
@@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
-module YAML
+module Syck
###
# Test null from YAML spec:
# http://yaml.org/type/null.html
diff --git a/test/yaml/test_omap.rb b/test/syck/test_omap.rb
index d1d30e9e93..8a2d7075b6 100644
--- a/test/yaml/test_omap.rb
+++ b/test/syck/test_omap.rb
@@ -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
diff --git a/test/yaml/test_set.rb b/test/syck/test_set.rb
index a3368769d1..d58f92e53f 100644
--- a/test/yaml/test_set.rb
+++ b/test/syck/test_set.rb
@@ -1,7 +1,7 @@
require 'test/unit'
require 'yaml'
-module YAML
+module Syck
class TestSet < Test::Unit::TestCase
def setup
@set = YAML::Set.new
diff --git a/test/yaml/test_string.rb b/test/syck/test_string.rb
index 26229a62f5..3bac75964f 100644
--- a/test/yaml/test_string.rb
+++ b/test/syck/test_string.rb
@@ -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"
diff --git a/test/yaml/test_struct.rb b/test/syck/test_struct.rb
index b5f944c788..cdd4814fd4 100644
--- a/test/yaml/test_struct.rb
+++ b/test/syck/test_struct.rb
@@ -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')
diff --git a/test/yaml/test_symbol.rb b/test/syck/test_symbol.rb
index c5358aa19d..39ffa8bb03 100644
--- a/test/yaml/test_symbol.rb
+++ b/test/syck/test_symbol.rb
@@ -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)
diff --git a/test/yaml/test_yaml.rb b/test/syck/test_yaml.rb
index 606c2676f1..ece1b768e3 100644
--- a/test/yaml/test_yaml.rb
+++ b/test/syck/test_yaml.rb
@@ -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')
diff --git a/test/yaml/test_yaml_properties.rb b/test/syck/test_yaml_properties.rb
index 48bb878a01..2df2e1cf76 100644
--- a/test/yaml/test_yaml_properties.rb
+++ b/test/syck/test_yaml_properties.rb
@@ -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
diff --git a/test/syck/test_yamlstore.rb b/test/syck/test_yamlstore.rb
new file mode 100644
index 0000000000..e78a7e4ecb
--- /dev/null
+++ b/test/syck/test_yamlstore.rb
@@ -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
diff --git a/test/yaml/test_yamlstore.rb b/test/yaml/test_yamlstore.rb
deleted file mode 100644
index 1374d32d24..0000000000
--- a/test/yaml/test_yamlstore.rb
+++ /dev/null
@@ -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