From 500bc36a29ee2f5ed126eb483ad69a8ed5c5155b Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 8 May 2014 19:29:35 +0300 Subject: [PATCH] testing escaped input is awkward --- test/parser/test_basic.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/parser/test_basic.rb b/test/parser/test_basic.rb index a178ecd5..aae32e71 100644 --- a/test/parser/test_basic.rb +++ b/test/parser/test_basic.rb @@ -32,6 +32,18 @@ class TestBasic < MiniTest::Test @parser = @parser.string end + def test_string_escapes + out = "hello nyou" + out[6] = '\\' + @string_input = "\"#{out}\"" + # puts will show that this is a string with a \n in it. + # but he who knows the ruby string rules well enough to do this in the input may win a beer at the ... + # puts @string_input + @parse_output = {:string=>out} #chop quotes off + @transform_output = Ast::StringExpression.new(out) + @parser = @parser.string + end + def test_assignment @string_input = "a = 5" @parse_output = { :asignee => { :name=>"a" } , :asigned => { :integer => "5" } }