1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require File.dirname(__FILE__) + '/fixtures/common'
4 describe "BaseResolver#resolve" do
6 @br = RbYAML::BaseResolver.new
7 @implicit = [true, false]
11 @br.resolve(RbYAML::ScalarNode, "username", @implicit).should == 'tag:yaml.org,2002:str'
15 @br.resolve(RbYAML::ScalarNode, ":username", @implicit).should == 'tag:yaml.org,2002:sym'
19 @br.resolve(RbYAML::ScalarNode, "true", @implicit).should == 'tag:yaml.org,2002:bool'
20 @br.resolve(RbYAML::ScalarNode, "false", @implicit).should == 'tag:yaml.org,2002:bool'
23 it "resolves float" do
24 @br.resolve(RbYAML::ScalarNode, "799.90", @implicit).should == 'tag:yaml.org,2002:float'
29 @br.resolve(RbYAML::ScalarNode, "800", @implicit).should == 'tag:yaml.org,2002:int'
31 @br.resolve(RbYAML::ScalarNode, "599999999", @implicit).should == 'tag:yaml.org,2002:int'
34 it "resolves merge" do
35 @br.resolve(RbYAML::ScalarNode, "<<", @implicit).should == 'tag:yaml.org,2002:merge'
39 @br.resolve(RbYAML::ScalarNode, "", @implicit).should == 'tag:yaml.org,2002:null'
40 @br.resolve(RbYAML::ScalarNode, "~", @implicit).should == 'tag:yaml.org,2002:null'
41 @br.resolve(RbYAML::ScalarNode, "null", @implicit).should == 'tag:yaml.org,2002:null'
44 it "resolves timestamp" do
45 @br.resolve(RbYAML::ScalarNode, "2001-07-02", @implicit).should == 'tag:yaml.org,2002:timestamp'
48 it "resolves value" do
49 @br.resolve(RbYAML::ScalarNode, "=", @implicit).should == 'tag:yaml.org,2002:value'