Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (26 sloc) 1.015 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
assert '""', "s=''; p s"
assert '"foo"', "s='foo'; p s"

assert "[]", "a=[]; p a"
assert "[1, 2, 3]", "a=[1,2,3]; p a"
assert 'nil', "a=[]; p a[42]"

assert "{}", "h={}; p h"
assert "{:in=>42}", "h={in: 42}; p h"
assert "3", "h={:un=>1,:deux=>2}; p h[:un]+h[:deux]"

assert '"foo246bar"', "p \"foo#{1+1}#{2+2}#{3+3}bar\""

assert ":ok", 'p :ok'
assert ":ok", 'p :"ok"'
assert ":ok", 'p :"#{:ok}"'
assert ":\"42\"", 'p :"#{40+2}"'
assert ":foo42", 'p :"foo#{40+2}"'

assert 'true', "p :foo == :foo"
assert 'true', "p :foo === :foo"
assert 'true', "p :foo != :bar"
assert 'false', "p :foo == :bar"
assert 'false', "p :foo === :bar"
assert 'false', "p :foo != :foo"

assert '42', "class Symbol; def ==(o); p 42; end; end; :foo == :foo"
assert '42', "class Symbol; def ===(o); p 42; end; end; :foo === :foo"
assert '42', "class Symbol; def !=(o); p 42; end; end; :foo != :foo"

assert "false", "p ['foo'] == [:foo]"

assert '424242', "a=''; 3.times { b=''; b << '42'; a<<b }; p a.to_i"

assert '42', 'p -> { 42 }.call'
Something went wrong with that request. Please try again.