From 81a56bce3a41896310bd1bed733b894b0c094979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 5 Mar 2013 10:02:31 +0100 Subject: [PATCH 1/7] Fix embedded YAML to be compatible with Psych. --- test/test-engines.rb | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/test/test-engines.rb b/test/test-engines.rb index 8f0705a..a183231 100644 --- a/test/test-engines.rb +++ b/test/test-engines.rb @@ -71,7 +71,8 @@ def _test() - name: ruby2_options lang: ruby class: Eruby - options: { :bufvar: '@_out_buf' } + options: + :bufvar: '@_out_buf' input: | <% for item in @items %> @@ -137,7 +138,9 @@ def _test() - name: c1 lang: c class: Ec - options: { :filename: foo.html, :indent: ' ' } + options: + :filename: foo.html + :indent: ' ' input: |4
@@ -167,7 +170,9 @@ def _test() - name: cpp1 lang: cpp class: Ecpp - options: { :filename: foo.html, :indent: ' ' } + options: + :filename: foo.html + :indent: ' ' input: |4
@@ -197,7 +202,10 @@ def _test() - name: java1 lang: java class: Ejava - options: { :buf: _buf, :bufclass: StringBuilder, :indent: ' ' } + options: + :buf: _buf, + :bufclass: StringBuilder + :indent: ' ' input: |
@@ -220,19 +228,19 @@ def _test() expected: |4 StringBuilder _buf = new StringBuilder(); _buf.append("
\n" + " \n"); - + int i = 0; for (Iterator it = list.iterator(); it.hasNext(); ) { String s = (String)it.next(); i++; - + _buf.append(" \n" + " \n" + " \n" + " \n"); - + } - + _buf.append(" \n" + "
"); _buf.append(i); _buf.append(""); _buf.append(escape(s)); _buf.append("
\n"); System.err.println("*** debug: i="+(i)); _buf.append("\n"); @@ -242,7 +250,7 @@ def _test() lang: scheme class: Escheme options: - input: &scheme1_input| + input: &scheme1_input | <% (let ((i 0)) %> @@ -290,7 +298,8 @@ def _test() - name: scheme2 lang: scheme class: Escheme - options: { :func: 'display' } + options: + :func: 'display' input: *scheme1_input expected: |4 (let ((i 0)) @@ -401,7 +410,8 @@ def _test() - name: javascript2 lang: javascript class: Ejavascript - options: { :docwrite: false } + options: + :docwrite: false input: *javascript_input expected: |4 var _buf = []; From bbf33e57251d353ffe4789c7f4e445305b707d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 5 Mar 2013 10:03:23 +0100 Subject: [PATCH 2/7] Fix embedded YAML to be compatible with Psych. --- test/test-erubis.rb | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/test/test-erubis.rb b/test/test-erubis.rb index ad00e5e..89e94f7 100644 --- a/test/test-erubis.rb +++ b/test/test-erubis.rb @@ -220,13 +220,13 @@ def test_evaluate_creates_proc __END__ - name: basic1 - input: &basic1_input| + input: &basic1_input | - src: &basic1_src| + src: &basic1_src | _buf = ''; _buf << ' '; _buf.to_s - output: &basic1_output| + output: &basic1_output |
<% for item in list %> @@ -677,7 +680,7 @@ def test_evaluate_creates_proc - name: optimized4 desc: single quotation and backslash class: OptimizedEruby - input: &optimized4_input| + input: &optimized4_input | a = "'" b = "\"" c = '\'' @@ -751,14 +754,14 @@ def test_evaluate_creates_proc - name: pi1 class: PI::Eruby testopt: evaluate - input: &input_pi1| + input: &input_pi1 | - src: &src_pi1| + src: &src_pi1 | _buf = ''; _buf << ' '; _buf.to_s - output: &output_pi1| + output: &output_pi1 |
! for item in list From f993710234852a713a351fcd06ca027b1b46d809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 5 Mar 2013 10:06:30 +0100 Subject: [PATCH 4/7] Add support for Ruby 2.0.0 error messages. --- test/test-main.rb | 13 +++++++++++++ test/testutil.rb | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/test/test-main.rb b/test/test-main.rb index 0e63229..e4d6c2a 100644 --- a/test/test-main.rb +++ b/test/test-main.rb @@ -272,6 +272,19 @@ def test_syntax2 # -z (syntax error) END errmsgs << <<'END' 7: syntax error, unexpected $end, expecting keyword_end +END + elsif ruby20? + errmsgs << <<'END' +3: syntax error, unexpected ']', expecting ')' + _buf << '
  • '; _buf << ( item[:name]] ).to_s; _buf << '
  • + ^ +-:4: syntax error, unexpected keyword_end, expecting ')' +'; end + ^ +-:7: syntax error, unexpected end-of-input, expecting ')' +END + errmsgs << <<'END' +7: syntax error, unexpected end-of-input, expecting keyword_end END elsif rubinius? errmsgs << <<'END' diff --git a/test/testutil.rb b/test/testutil.rb index e5293a5..59c3779 100644 --- a/test/testutil.rb +++ b/test/testutil.rb @@ -17,6 +17,10 @@ def ruby19? # :nodoc: RUBY_VERSION =~ /\A1.9/ end +def ruby20? # :nodoc: + RUBY_VERSION =~ /\A2.0/ +end + def rubinius? # :nodoc: defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" end From 99d0db2f38d7a4b9cf782e2e4a73bde0d73277e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 5 Mar 2013 10:07:02 +0100 Subject: [PATCH 5/7] Add support for Ruby 2.0.0. --- test/test-users-guide.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-users-guide.rb b/test/test-users-guide.rb index 2687a83..b89706b 100644 --- a/test/test-users-guide.rb +++ b/test/test-users-guide.rb @@ -28,7 +28,7 @@ def _test s =~ /\A\$ (.*?)\n/ command = $1 expected = $' - if ruby19? + if ruby19? || ruby20? case @name when 'test_main_program1_result' expected.sub!('["eruby", "items", "x", "_buf"]', '[:_buf, :eruby, :items, :x]') From 4a986d3a8f3cc4bfeacf1c1def3c6375c4866dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 23 Jun 2014 14:25:16 +0200 Subject: [PATCH 6/7] Add support for Ruby 2.1. --- test/test-main.rb | 2 +- test/test-users-guide.rb | 2 +- test/testutil.rb | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test-main.rb b/test/test-main.rb index e4d6c2a..9dbe12e 100644 --- a/test/test-main.rb +++ b/test/test-main.rb @@ -273,7 +273,7 @@ def test_syntax2 # -z (syntax error) errmsgs << <<'END' 7: syntax error, unexpected $end, expecting keyword_end END - elsif ruby20? + elsif ruby20? || ruby21? errmsgs << <<'END' 3: syntax error, unexpected ']', expecting ')' _buf << '
  • '; _buf << ( item[:name]] ).to_s; _buf << '
  • diff --git a/test/test-users-guide.rb b/test/test-users-guide.rb index b89706b..fee5435 100644 --- a/test/test-users-guide.rb +++ b/test/test-users-guide.rb @@ -28,7 +28,7 @@ def _test s =~ /\A\$ (.*?)\n/ command = $1 expected = $' - if ruby19? || ruby20? + if ruby19? || ruby20? || ruby21? case @name when 'test_main_program1_result' expected.sub!('["eruby", "items", "x", "_buf"]', '[:_buf, :eruby, :items, :x]') diff --git a/test/testutil.rb b/test/testutil.rb index 59c3779..1b841c3 100644 --- a/test/testutil.rb +++ b/test/testutil.rb @@ -21,6 +21,10 @@ def ruby20? # :nodoc: RUBY_VERSION =~ /\A2.0/ end +def ruby21? # :nodoc: + RUBY_VERSION =~ /\A2.1/ +end + def rubinius? # :nodoc: defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" end From 82d85b70f66de8c8c6f6ecb52f6536711c1de591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 21 Jan 2015 16:46:45 +0100 Subject: [PATCH 7/7] Add support for Ruby 2.2. --- test/test-main.rb | 4 ++-- test/test-users-guide.rb | 2 +- test/testutil.rb | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/test-main.rb b/test/test-main.rb index 9dbe12e..eca7b21 100644 --- a/test/test-main.rb +++ b/test/test-main.rb @@ -216,7 +216,7 @@ def _with_dummy_file begin ENV['PATH'] = bindir + File::PATH_SEPARATOR + ENV['PATH'] ENV['_'] = 'erubis' - Tempfile.open(self.name.gsub(/[^\w]/,'_')) do |f| + Tempfile.open(self.method_name.gsub(/[^\w]/,'_')) do |f| f.write(INPUT) f.flush yield(f.path) @@ -273,7 +273,7 @@ def test_syntax2 # -z (syntax error) errmsgs << <<'END' 7: syntax error, unexpected $end, expecting keyword_end END - elsif ruby20? || ruby21? + elsif ruby20? || ruby21? || ruby22? errmsgs << <<'END' 3: syntax error, unexpected ']', expecting ')' _buf << '
  • '; _buf << ( item[:name]] ).to_s; _buf << '
  • diff --git a/test/test-users-guide.rb b/test/test-users-guide.rb index fee5435..af6c006 100644 --- a/test/test-users-guide.rb +++ b/test/test-users-guide.rb @@ -28,7 +28,7 @@ def _test s =~ /\A\$ (.*?)\n/ command = $1 expected = $' - if ruby19? || ruby20? || ruby21? + if ruby19? || ruby20? || ruby21? || ruby22? case @name when 'test_main_program1_result' expected.sub!('["eruby", "items", "x", "_buf"]', '[:_buf, :eruby, :items, :x]') diff --git a/test/testutil.rb b/test/testutil.rb index 1b841c3..e9130b7 100644 --- a/test/testutil.rb +++ b/test/testutil.rb @@ -25,6 +25,10 @@ def ruby21? # :nodoc: RUBY_VERSION =~ /\A2.1/ end +def ruby22? # :nodoc: + RUBY_VERSION =~ /\A2.2/ +end + def rubinius? # :nodoc: defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" end