summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-17 17:17:07 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-17 17:17:07 +0000
commit06c4c45f7f731bbf9adb214b2963760754a69f5d (patch)
treecbded9f4a1d6c8b0055ede4b233f013bdc0eaaf6 /test
parent82cba4762a2f62a6330086d40233c968228119f6 (diff)
* lib/yaml/rubytypes.rb: remove comments that are bungling up
the rdoc and ri output. output symbols as plain scalars. * ext/syck/rubyext.c (syck_emitter_reset): emit headless documents always. * ext/syck/emitter.c (syck_scan_scalar): quote scalars with any kind of surrounding line space, tabs or spaces alike. * ext/syck/token.c: accept tabs as whitespace, not for indentation, but strip from plain scalars. * test/yaml/test_yaml.rb: remove outdated tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/yaml/test_yaml.rb35
1 files changed, 13 insertions, 22 deletions
diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb
index 05332a6e40..fd91fa866c 100644
--- a/test/yaml/test_yaml.rb
+++ b/test/yaml/test_yaml.rb
@@ -632,15 +632,17 @@ EOY
end
def test_spec_domain_prefix
- YAML.add_domain_type( "domain.tld,2002", /(invoice|customer)/ ) { |type, val|
- if Hash === val
+ customer_proc = proc { |type, val|
+ if Hash === val
scheme, domain, type = type.split( ':', 3 )
- val['type'] = "domain #{type}"
- val
- else
- raise ArgumentError, "Not a Hash in domain.tld,2002/invoice: " + val.inspect
- end
- }
+ val['type'] = "domain #{type}"
+ val
+ else
+ raise ArgumentError, "Not a Hash in domain.tld,2002/invoice: " + val.inspect
+ end
+ }
+ YAML.add_domain_type( "domain.tld,2002", 'invoice', &customer_proc )
+ YAML.add_domain_type( "domain.tld,2002", 'customer', &customer_proc )
assert_parse_only( { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }, <<EOY
# 'http://domain.tld,2002/invoice' is some type family.
invoice: !domain.tld,2002/^invoice
@@ -744,9 +746,9 @@ EOY
end
def test_spec_explicit_families
- YAML.add_domain_type( "somewhere.com,2002", /^type$/ ) { |type, val|
- "SOMEWHERE: #{val}"
- }
+ YAML.add_domain_type( "somewhere.com,2002", 'type' ) { |type, val|
+ "SOMEWHERE: #{val}"
+ }
assert_parse_only(
{ 'not-date' => '2002-04-28', 'picture' => "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236i^\020' \202\n\001\000;", 'hmm' => "SOMEWHERE: family above is short for\nhttp://somewhere.com/type\n" }, <<EOY
not-date: !str 2002-04-28
@@ -1049,17 +1051,6 @@ EOY
)
end
- def test_perl_regexp
- # Parsing perl regular expressions from YAML.pm
- assert_parse_only(
- [ /bozo$/i ], <<EOY
-- !perl/regexp:
- regexp: bozo$
- mods: i
-EOY
- )
- end
-
#
# Test of Ranges
#