forked from IronLanguages/main
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to YAML.quick_emit to be called on nested objects where…
… the same emitter needs to be flowed through Array.pack("a") was not dealing with nil input yaml.rb should to "require stringio" like MRI does Deleted a second copy of yaml.rb from the IronRuby.Libraries.Yaml folder Added MutableString.Dump property to be able to inspect large strings in VS. ir.exe -X:ExceptionDetail was not working in interactive mode because ir.exe catches the exception and does not call RubyExceptionData.SetCompiledTrace like a rescue block in Ruby code would do. Fixed this
- Loading branch information
Shri Borde
committed
Mar 13, 2009
1 parent
f45cbfc
commit a5d2d23
Showing
32 changed files
with
461 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
Merlin/External/Languages/IronRuby/Yaml/IronRuby.Libraries.Yaml/yaml.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/library/yaml/each_node_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:YAML.each_node invokes block with a BaseNode |
2 changes: 2 additions & 0 deletions
2
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/library/yaml/emitter_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:YAML.emitter is of type Emitter | ||
fails:YAML.emitter has a default level of 0 |
5 changes: 5 additions & 0 deletions
5
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/library/yaml/quick_emit_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:YAML.quick_emit returns a BaseNode node if emitter level is non-zero | ||
fails:YAML.quick_emit passes Out to block | ||
fails:YAML.quick_emit accepts Emitter argument | ||
fails:YAML.quick_emit requires opts parameter to be a Hash or Emitter | ||
fails:YAML.quick_emit requires a block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...in/External/Languages/IronRuby/mspec/ironruby-tags/library/zlib/gzipwriter/flush_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:Zlib::GzipWriter#flush raises BufError if called multiple times without writing data | ||
fails:Zlib::GzipWriter#flush Zlib::FINISH closes the writer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/yaml/each_node_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
require File.dirname(__FILE__) + '/fixtures/common' | ||
require File.dirname(__FILE__) + '/fixtures/strings' | ||
|
||
describe "YAML.each_node" do | ||
it "invokes block with a BaseNode" do | ||
node = nil | ||
YAML.each_node(StringIO.new($test_yaml_string)) { |n| node = n } | ||
node.should be_kind_of(YAML::BaseNode) | ||
not_compliant_on :ironruby do | ||
node.should be_kind_of(YAML::Syck::Map) | ||
end | ||
end | ||
|
||
it "invokes block once for a simple string " do | ||
i = 0 | ||
YAML.each_node(StringIO.new($test_yaml_string)) { |node| i = i + 1 } | ||
i.should == 1 | ||
end | ||
|
||
it "invokes block n times for a string with n documents" do | ||
i = 0 | ||
YAML.each_node(StringIO.new($multidocument)) { |node| i = i + 1 } | ||
i.should == 2 | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/yaml/emitter_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
require File.dirname(__FILE__) + '/fixtures/common' | ||
|
||
describe "YAML.emitter" do | ||
it "is of type Emitter" do | ||
(YAML.emitter.methods - Object.new.methods).sort.should == YamlSpecs::EmitterMethods | ||
not_compliant_on :ironruby do | ||
YAML.emitter.class.should == YAML::Syck::Emitter | ||
end | ||
end | ||
|
||
it "has a default level of 0" do | ||
YAML.emitter.level.should == 0 | ||
end | ||
end |
71 changes: 71 additions & 0 deletions
71
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/yaml/fixtures/common.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,75 @@ | ||
require 'yaml' | ||
require File.dirname(__FILE__) + '/strings' | ||
|
||
$test_file = tmp("yaml_test_file") | ||
$test_parse_file = File.dirname(__FILE__) + "/test_yaml.yml" | ||
|
||
module YamlSpecs | ||
EmitterMethods = ["emit", "level", "level=", "node_export", "reset", "set_resolver"] | ||
OutMethods = ["emitter", "emitter=", "map", "scalar", "seq"] | ||
|
||
def self.get_a_node | ||
io = StringIO.new($test_yaml_string) | ||
YAML.each_node(io) { |node| return node } | ||
end | ||
|
||
def self.write_to_emitter out, h | ||
out.map(nil, nil) do |map| | ||
h.each_pair { |k, v| map.add(k, v) } | ||
end | ||
end | ||
|
||
class Outer | ||
def initialize | ||
@outer1 = 1 | ||
@outer2 = Inner.new | ||
end | ||
end | ||
|
||
class Inner | ||
def initialize | ||
@inner1 = 1 | ||
@inner2 = 2 | ||
end | ||
end | ||
|
||
class OuterToYaml | ||
def initialize | ||
@outer1 = 1 | ||
@outer2 = InnerToYaml.new | ||
end | ||
|
||
def inner | ||
@outer2 | ||
end | ||
end | ||
|
||
class InnerToYaml | ||
def initialize | ||
@inner1 = 1 | ||
@inner2 = 2 | ||
end | ||
|
||
def to_yaml emitter | ||
if ScratchPad.recorded != nil then | ||
ScratchPad.recorded[:emitter] = emitter | ||
if emitter.respond_to? :level then | ||
ScratchPad.recorded[:level] = emitter.level | ||
end | ||
end | ||
|
||
node = YAML::quick_emit(nil, emitter) do |out| | ||
out.map("tag:ruby.yaml.org,2002:object:YamlSpecs::InnerToYaml", to_yaml_style) do |map| | ||
map.add("inner1", @inner1) | ||
map.add("inner2", @inner2) | ||
end | ||
end | ||
|
||
if ScratchPad.recorded != nil then | ||
ScratchPad.recorded[:result] = node | ||
end | ||
|
||
node | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,12 @@ | |
2001-08-14 ] | ||
EOY | ||
|
||
$test_yaml_string = | ||
<<EOY | ||
project: | ||
name: RubySpec | ||
EOY | ||
|
||
$to_yaml_hash = | ||
<<EOY | ||
- | ||
|
Oops, something went wrong.