Sha256: 8cd041c3b94db0e87e47fae840a3caf723434f30951610ced933d566f94520ea

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# 
# describe "The if expression" do
#   it "evaluates body if expression is true" do
#     a = []
#     if true
#       a << 123
#     end
#     a.should == [123]
#   end
#   
#   it "does not evaluate body if expression is false" do
#     a = []
#     if false
#       a << 123
#     end
#     a.should == []
#   end
#   
#   it "does not evaluate body if expression is empty" do
#     a = []
#     if ()
#       a << 123
#     end
#     a.should == []
#   end
#   
#   it "does not evaluate else body if expression is true" do
#     a = []
#     if true
#       a << 123
#     else
#       a << 456
#     end
#     a.should == [123]
#   end
#   
#   it "evaluates only else-body if expression is false" do
#     a = []
#     if false
#       a << 123
#     else
#       a << 456
#     end
#     a.should == [456]
#   end
#   
#   it "returns result of then-body evaluation if expression is true" do
#     # raise "this causes error: return is injected before if = javascript error"
#     # if true
#       # 123
#     # end.should == 456
#   end
# end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-0.3.2 gems/core/spec/language/if_spec.rb
opal-0.3.1 gems/core/spec/language/if_spec.rb
opal-0.3.0 gems/core/spec/language/if_spec.rb
opal-0.2.2 opals/opal/opal/spec/language/if_spec.rb
opal-0.2.0 opals/opal/opal/spec/language/if_spec.rb
opal-0.1.0 opals/opal/spec/language/if_spec.rb