Sha256: 7685ebac835dd687ea48cc27a3a646292093b2150bd6877db134ddee9523cd58
Contents?: true
Size: 882 Bytes
Versions: 2
Compression:
Stored size: 882 Bytes
Contents
require 'spec_helper' describe "The module keyword" do it "returns an empty s(:block) when given an empty body" do opal_parse('module A; end').should == [:module, :A, [:block]] end it "does not place single expressions into a s(:block)" do opal_parse('module A; 1; end').should == [:module, :A, [:int, 1]] end it "adds multiple body expressions into a s(:block)" do opal_parse('module A; 1; 2; end').should == [:module, :A, [:block, [:int, 1], [:int, 2]]] end it "should accept just a constant for the module name" do opal_parse('module A; end')[1].should == :A end it "should accept a prefix constant for the module name" do opal_parse('module ::A; end')[1].should == [:colon3, :A] end it "should accepts a nested constant for the module name" do opal_parse('module A::B; end')[1].should == [:colon2, [:const, :A], :B] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opal-0.5.5 | spec/opal/parser/module_spec.rb |
opal-0.5.4 | spec/opal/parser/module_spec.rb |