Grammar and stream of consciousness cleanup for Channel and Scheduler rdoc
[rbx.git] / spec / library / rbyaml / resolver_spec.rb
blob6d1b46e925d676fe39a005777979e664e14d0a5d
1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require File.dirname(__FILE__) + '/fixtures/common'
4 describe "BaseResolver#resolve" do
5   before(:all) do
6     @br = RbYAML::BaseResolver.new
7     @implicit = [true, false]
8   end
10   it "resolves str" do
11     @br.resolve(RbYAML::ScalarNode, "username", @implicit).should == 'tag:yaml.org,2002:str'
12   end
14   it "resolves sym" do
15     @br.resolve(RbYAML::ScalarNode, ":username", @implicit).should == 'tag:yaml.org,2002:sym'
16   end
18   it "resolves bool" do
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'
21   end
23   it "resolves float" do
24     @br.resolve(RbYAML::ScalarNode, "799.90", @implicit).should == 'tag:yaml.org,2002:float'
25   end
27   it "resolves int" do
28     # Fixnum
29     @br.resolve(RbYAML::ScalarNode, "800", @implicit).should == 'tag:yaml.org,2002:int'
30     # Bignum
31     @br.resolve(RbYAML::ScalarNode, "599999999", @implicit).should == 'tag:yaml.org,2002:int'
32   end
34   it "resolves merge" do
35     @br.resolve(RbYAML::ScalarNode, "<<", @implicit).should == 'tag:yaml.org,2002:merge'
36   end
38   it "resolves null" do
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'
42   end
44   it "resolves timestamp" do
45     @br.resolve(RbYAML::ScalarNode, "2001-07-02", @implicit).should == 'tag:yaml.org,2002:timestamp'
46   end
48   it "resolves value" do
49     @br.resolve(RbYAML::ScalarNode, "=", @implicit).should == 'tag:yaml.org,2002:value'
50   end
51 end