Sha256: 0cee5f39e7e7bc3d02259019441192eae55140300c2130c24d3c9818dbbd4036
Contents?: true
Size: 935 Bytes
Versions: 6
Compression:
Stored size: 935 Bytes
Contents
require File.expand_path('../../spec_helper', __FILE__) describe "The module keyword" do it "returns a plain s(:scope) when given an empty body" do opal_parse('module A; end').should == [:module, :A, [:scope]] end it "does not place single expressions into a s(:block)" do opal_parse('module A; 1; end').should == [:module, :A, [:scope, [:lit, 1]]] end it "adds multiple body expressions into a s(:block)" do opal_parse('module A; 1; 2; end').should == [:module, :A, [:scope, [:block, [:lit, 1], [:lit, 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
6 entries across 6 versions & 1 rubygems