Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 19dde1d3 authored by Ary Borenszweig's avatar Ary Borenszweig
Browse files

Added StringLiteral#captialize in macros

parent 8d62dd94
Branches
Tags
No related merge requests found
......@@ -191,6 +191,10 @@ describe "MacroExpander" do
assert_macro "", %({{"hello".upcase}}), [] of ASTNode, "HELLO"
end
it "executes capitalize" do
assert_macro "", %({{"hello".capitalize}}), [] of ASTNode, "Hello"
end
it "executes lines" do
assert_macro "x", %({{x.lines}}), [StringLiteral.new("1\n2\n3")] of ASTNode, %(["1", "2", "3"])
end
......
......@@ -471,6 +471,8 @@ module Crystal
raise "wrong argument for StringLiteral#[] (#{arg.class_desc}): #{arg}"
end
end
when "capitalize"
interpret_argless_method(method, args) { StringLiteral.new(@value.capitalize) }
when "downcase"
interpret_argless_method(method, args) { StringLiteral.new(@value.downcase) }
when "empty?"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment