Forum | Documentation | Website | Blog

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

Added StringLiteral#chomp in macros

parent a525575a
Branches
Tags BVF-0.5.0
No related merge requests found
......@@ -278,6 +278,10 @@ describe "MacroExpander" do
it "executes string [Range] exclusive" do
assert_macro "", %({{"hello"[1...-2]}}), [] of ASTNode, %("el")
end
it "executes string chomp" do
assert_macro "", %({{"hello\n".chomp}}), [] of ASTNode, %("hello")
end
end
describe "array methods" do
......
......@@ -729,6 +729,8 @@ module Crystal
end
when "capitalize"
interpret_argless_method(method, args) { StringLiteral.new(@value.capitalize) }
when "chomp"
interpret_argless_method(method, args) { StringLiteral.new(@value.chomp) }
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