* ext/syck/MANIFEST, ext/syck/depend: new file.
* lib/yaml/rubytypes.rb: range of exponential floats. [ruby-core:02824] * test/yaml/test_yaml.rb: tests for strings start with colon and some round trip. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
36de1f6acb
commit
79133371e8
11
ChangeLog
11
ChangeLog
@ -1,3 +1,12 @@
|
|||||||
|
Sat May 15 13:38:33 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/syck/MANIFEST, ext/syck/depend: new file.
|
||||||
|
|
||||||
|
* lib/yaml/rubytypes.rb: range of exponential floats. [ruby-core:02824]
|
||||||
|
|
||||||
|
* test/yaml/test_yaml.rb: tests for strings start with colon and some
|
||||||
|
round trip.
|
||||||
|
|
||||||
Sat May 15 12:04:58 2004 why the lucky stiff <why@ruby-lang.org>
|
Sat May 15 12:04:58 2004 why the lucky stiff <why@ruby-lang.org>
|
||||||
|
|
||||||
* lib/yaml.rb: removed fallback to pure Ruby parser.
|
* lib/yaml.rb: removed fallback to pure Ruby parser.
|
||||||
@ -44,7 +53,7 @@ Fri May 14 21:29:26 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||||||
Fri May 14 18:37:49 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Fri May 14 18:37:49 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tk/canvas.rb: improve coords support for canvas
|
* ext/tk/lib/tk/canvas.rb: improve coords support for canvas
|
||||||
items. Now, supports all of the followings.
|
items. Now, supports all of the followings.
|
||||||
TkcLine.new(c, 0, 0, 100, 100, :fill=>'red')
|
TkcLine.new(c, 0, 0, 100, 100, :fill=>'red')
|
||||||
TkcLine.new(c, [0, 0, 100, 100], :fill=>'red')
|
TkcLine.new(c, [0, 0, 100, 100], :fill=>'red')
|
||||||
TkcLine.new(c, [0, 0], [100, 100], :fill=>'red')
|
TkcLine.new(c, [0, 0], [100, 100], :fill=>'red')
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
MANIFEST
|
MANIFEST
|
||||||
|
depend
|
||||||
extconf.rb
|
extconf.rb
|
||||||
bytecode.c
|
bytecode.c
|
||||||
emitter.c
|
emitter.c
|
||||||
|
10
ext/syck/depend
Normal file
10
ext/syck/depend
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
handler.o: handler.c syck.h
|
||||||
|
emitter.o: emitter.c syck.h
|
||||||
|
implicit.o: implicit.c syck.h
|
||||||
|
gram.o: gram.c syck.h
|
||||||
|
bytecode.o: bytecode.c syck.h gram.h
|
||||||
|
node.o: node.c syck.h
|
||||||
|
syck.o: syck.c syck.h
|
||||||
|
token.o: token.c syck.h gram.h
|
||||||
|
yaml2byte.o: yaml2byte.c syck.h yamlbyte.h
|
||||||
|
rubyext.o: rubyext.c syck.h
|
@ -371,7 +371,7 @@ end
|
|||||||
|
|
||||||
symbol_proc = Proc.new { |type, val|
|
symbol_proc = Proc.new { |type, val|
|
||||||
if String === val
|
if String === val
|
||||||
val = YAML::load( "--- #{val}") if val =~ /^["'].*["']$/
|
val = YAML::load( "--- #{val}") if val =~ /^["'].*['"]$/
|
||||||
val.intern
|
val.intern
|
||||||
else
|
else
|
||||||
raise YAML::Error, "Invalid Symbol: " + val.inspect
|
raise YAML::Error, "Invalid Symbol: " + val.inspect
|
||||||
@ -414,9 +414,9 @@ end
|
|||||||
|
|
||||||
YAML.add_ruby_type( /^range/ ) { |type, val|
|
YAML.add_ruby_type( /^range/ ) { |type, val|
|
||||||
type, obj_class = YAML.read_type_class( type, ::Range )
|
type, obj_class = YAML.read_type_class( type, ::Range )
|
||||||
inr = '(\w+|[+-]*\d+(?:\.\d+)?|"(?:[^\\"]|\\.)*")'
|
inr = %r'(\w+|[+-]?\d+(?:\.\d+)?(?:e[+-]\d+)?|"(?:[^\\"]|\\.)*")'
|
||||||
opts = {}
|
opts = {}
|
||||||
if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/
|
if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/o
|
||||||
r1, rdots, r2 = $1, $2, $3
|
r1, rdots, r2 = $1, $2, $3
|
||||||
opts = {
|
opts = {
|
||||||
'begin' => YAML.load( "--- #{r1}" ),
|
'begin' => YAML.load( "--- #{r1}" ),
|
||||||
|
@ -33,6 +33,10 @@ class YAML_Unit_Tests < Test::Unit::TestCase
|
|||||||
assert_equal( obj, YAML::parse( yaml ).transform )
|
assert_equal( obj, YAML::parse( yaml ).transform )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def assert_cycle( obj )
|
||||||
|
assert_equal( obj, YAML::load( obj.to_yaml ) )
|
||||||
|
end
|
||||||
|
|
||||||
def assert_path_segments( path, segments )
|
def assert_path_segments( path, segments )
|
||||||
YAML::YPath.each_path( path ) { |choice|
|
YAML::YPath.each_path( path ) { |choice|
|
||||||
assert_equal( choice.segments, segments.shift )
|
assert_equal( choice.segments, segments.shift )
|
||||||
@ -71,10 +75,14 @@ EOY
|
|||||||
|
|
||||||
def test_basic_strings
|
def test_basic_strings
|
||||||
# Common string types
|
# Common string types
|
||||||
|
assert_cycle("x")
|
||||||
|
assert_cycle(":x")
|
||||||
|
assert_cycle(":")
|
||||||
assert_parse_only(
|
assert_parse_only(
|
||||||
{ 1 => 'simple string', 2 => 42, 3 => '1 Single Quoted String',
|
{ 1 => 'simple string', 2 => 42, 3 => '1 Single Quoted String',
|
||||||
4 => 'YAML\'s Double "Quoted" String', 5 => "A block\n with several\n lines.\n",
|
4 => 'YAML\'s Double "Quoted" String', 5 => "A block\n with several\n lines.\n",
|
||||||
6 => "A \"chomped\" block", 7 => "A folded\n string\n" }, <<EOY
|
6 => "A \"chomped\" block", 7 => "A folded\n string\n", 8 => ": started string" },
|
||||||
|
<<EOY
|
||||||
1: simple string
|
1: simple string
|
||||||
2: 42
|
2: 42
|
||||||
3: '1 Single Quoted String'
|
3: '1 Single Quoted String'
|
||||||
@ -89,6 +97,7 @@ EOY
|
|||||||
A
|
A
|
||||||
folded
|
folded
|
||||||
string
|
string
|
||||||
|
8: ": started string"
|
||||||
EOY
|
EOY
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -380,7 +389,7 @@ EOY
|
|||||||
assert_parse_only(
|
assert_parse_only(
|
||||||
[ "Mark McGwire's year was crippled by a knee injury.\n" ], <<EOY
|
[ "Mark McGwire's year was crippled by a knee injury.\n" ], <<EOY
|
||||||
- >
|
- >
|
||||||
Mark McGwire's
|
Mark McGwire\'s
|
||||||
year was crippled
|
year was crippled
|
||||||
by a knee injury.
|
by a knee injury.
|
||||||
EOY
|
EOY
|
||||||
@ -909,7 +918,7 @@ literal: |
|
|||||||
single line break, but does
|
single line break, but does
|
||||||
not start with one.
|
not start with one.
|
||||||
|
|
||||||
is equal to: "The \\ \' \\" characters may \\
|
is equal to: "The \\ ' \\" characters may \\
|
||||||
be\\nfreely used. Leading white\\n space \\
|
be\\nfreely used. Leading white\\n space \\
|
||||||
is significant.\\n\\nLine breaks are \\
|
is significant.\\n\\nLine breaks are \\
|
||||||
significant.\\nThus this value contains \\
|
significant.\\nThus this value contains \\
|
||||||
@ -1031,7 +1040,7 @@ EOY
|
|||||||
def test_ruby_regexp
|
def test_ruby_regexp
|
||||||
# Test Ruby regular expressions
|
# Test Ruby regular expressions
|
||||||
assert_to_yaml(
|
assert_to_yaml(
|
||||||
{ 'simple' => /a.b/, 'complex' => /\A"((?:[^"]|\")+)"/,
|
{ 'simple' => /a.b/, 'complex' => %r'\A"((?:[^"]|\")+)"',
|
||||||
'case-insensitive' => /George McFly/i }, <<EOY
|
'case-insensitive' => /George McFly/i }, <<EOY
|
||||||
case-insensitive: !ruby/regexp "/George McFly/i"
|
case-insensitive: !ruby/regexp "/George McFly/i"
|
||||||
complex: !ruby/regexp "/\\\\A\\"((?:[^\\"]|\\\\\\")+)\\"/"
|
complex: !ruby/regexp "/\\\\A\\"((?:[^\\"]|\\\\\\")+)\\"/"
|
||||||
@ -1191,7 +1200,7 @@ EOY
|
|||||||
require 'yaml'
|
require 'yaml'
|
||||||
t = Time.now
|
t = Time.now
|
||||||
5.times do
|
5.times do
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
assert_cycle(t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1202,22 +1211,19 @@ EOY
|
|||||||
#
|
#
|
||||||
# From Minero Aoki [ruby-core:02306]
|
# From Minero Aoki [ruby-core:02306]
|
||||||
#
|
#
|
||||||
t = "a".."z"
|
assert_cycle("a".."z")
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# From Nobu Nakada [ruby-core:02311]
|
# From Nobu Nakada [ruby-core:02311]
|
||||||
#
|
#
|
||||||
t = 0..1
|
assert_cycle(0..1)
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
assert_cycle(1.0e20 .. 2.0e20)
|
||||||
t = "0".."1"
|
assert_cycle("0".."1")
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
assert_cycle(".."..."...")
|
||||||
t = ".."..."..."
|
assert_cycle(".rb"..".pl")
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
assert_cycle(".rb"...".pl")
|
||||||
t = ".rb"..".pl"
|
assert_cycle('"'...".")
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
assert_cycle("'"...".")
|
||||||
t = ".rb"...".pl"
|
|
||||||
assert_equal( t, YAML.load( YAML.dump( t ) ) )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user