spec/ast_spec.rb in webidl-0.0.2 vs spec/ast_spec.rb in webidl-0.0.3
- old
+ new
@@ -136,10 +136,21 @@
interface = parse(fixture("interface_with_inheritance.idl")).build.last
interface.inherits.should_not be_empty
interface.inherits.first.qualified_name.should == "::foo"
end
+ it "creates an interface with an array type member" do
+ interface = parse(fixture("interface_with_array_member.idl")).build.first
+ interface.should be_kind_of(WebIDL::Ast::Interface)
+
+ attr = interface.members.first
+ attr.should be_kind_of(WebIDL::Ast::Attribute)
+
+ attr.type.should be_kind_of(WebIDL::Ast::Type)
+ attr.type.name.should == :UnsignedShortArray
+ end
+
it "creates a framework from the example in the WebIDL spec" do
mod = parse(fixture("framework.idl")).build.first
mod.definitions.size.should == 4
mod.definitions.map { |e| e.class}.should == [
WebIDL::Ast::TypeDef,
@@ -175,15 +186,15 @@
first.should be_kind_of(WebIDL::Ast::Const)
first.name.should == "ERR_NOT_FOUND"
first.qualified_name.should == '::framework::FrameworkException::ERR_NOT_FOUND'
first.type.should be_kind_of(WebIDL::Ast::Type)
- first.type.name.should == :long
+ first.type.name.should == :Long
first.value.should == 1
last.should be_kind_of(WebIDL::Ast::Field)
last.type.should be_kind_of(WebIDL::Ast::Type)
- last.type.name.should == :long
+ last.type.name.should == :Long
last.name.should == "code"
end
it "creates an attribute" do