Hello community,

here is the log from the commit of package rubygem-erubi for openSUSE:Factory 
checked in at 2020-12-11 20:16:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-erubi (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-erubi.new.2328 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-erubi"

Fri Dec 11 20:16:19 2020 rev:6 rq:854705 version:1.10.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-erubi/rubygem-erubi.changes      
2019-11-13 13:26:58.707613317 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-erubi.new.2328/rubygem-erubi.changes    
2020-12-11 20:16:20.344650280 +0100
@@ -1,0 +2,11 @@
+Fri Dec 11 03:11:59 UTC 2020 - Manuel Schnitzer <mschnit...@suse.com>
+
+- updated to version 1.10.0
+
+  * Improve template parsing, mostly by reducing allocations (jeremyevans)
+
+  * Do not ship tests in the gem, reducing gem size about 20% (jeremyevans)
+
+  * Support :literal_prefix and :literal_postfix options for how to output 
literal tags (e.g. <%% code %>) (jaredcwhite) (#26, #27)
+
+-------------------------------------------------------------------

Old:
----
  erubi-1.9.0.gem

New:
----
  erubi-1.10.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-erubi.spec ++++++
--- /var/tmp/diff_new_pack.7LhxjK/_old  2020-12-11 20:16:20.940650527 +0100
+++ /var/tmp/diff_new_pack.7LhxjK/_new  2020-12-11 20:16:20.944650529 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-erubi
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-erubi
-Version:        1.9.0
+Version:        1.10.0
 Release:        0
 %define mod_name erubi
 %define mod_full_name %{mod_name}-%{version}
@@ -33,7 +33,7 @@
 BuildRequires:  %{rubygem rdoc > 3.10}
 BuildRequires:  %{ruby}
 BuildRequires:  ruby-macros >= 5
-Url:            https://github.com/jeremyevans/erubi
+URL:            https://github.com/jeremyevans/erubi
 Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
 Summary:        Small ERB Implementation

++++++ erubi-1.9.0.gem -> erubi-1.10.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG new/CHANGELOG
--- old/CHANGELOG       2019-09-25 17:47:29.000000000 +0200
+++ new/CHANGELOG       2020-11-13 22:39:58.000000000 +0100
@@ -1,3 +1,11 @@
+=== 1.10.0 (2020-11-13)
+
+* Improve template parsing, mostly by reducing allocations (jeremyevans)
+
+* Do not ship tests in the gem, reducing gem size about 20% (jeremyevans)
+
+* Support :literal_prefix and :literal_postfix options for how to output 
literal tags (e.g. <%% code %>) (jaredcwhite) (#26, #27)
+
 === 1.9.0 (2019-09-25)
 
 * Change default :bufvar from 'String.new' to '::String.new' to work with 
BasicObject (jeremyevans)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MIT-LICENSE new/MIT-LICENSE
--- old/MIT-LICENSE     2019-09-25 17:47:29.000000000 +0200
+++ new/MIT-LICENSE     2020-11-13 22:39:58.000000000 +0100
@@ -1,5 +1,5 @@
 copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
-copyright(c) 2016-2018 Jeremy Evans
+copyright(c) 2016-2020 Jeremy Evans
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.rdoc new/README.rdoc
--- old/README.rdoc     2019-09-25 17:47:29.000000000 +0200
+++ new/README.rdoc     2020-11-13 22:39:58.000000000 +0100
@@ -5,9 +5,9 @@
 
 * Handles postfix conditionals when using escaping (e.g. <tt><%= foo if bar 
%></tt>)
 * Supports frozen_string_literal: true in templates via :freeze option
-* Works with ruby's --enable-frozen-string-literal option
+* Works with ruby's <tt>--enable-frozen-string-literal</tt> option
 * Automatically freezes strings for template text when ruby optimizes it (on 
ruby 2.1+)
-* Escapes ' (apostrophe) when escaping for better XSS protection 
+* Escapes <tt>'</tt> (apostrophe) when escaping for better XSS protection 
 * Has 6x faster escaping on ruby 2.3+ by using cgi/escape
 * Has 86% smaller memory footprint
 * Does no monkey patching (Erubis adds a method to Kernel)
@@ -92,7 +92,7 @@
   # </form>
   # after
 
-Alternatively, passing the option +:yield_returns_buffer => true+ will return 
the
+Alternatively, passing the option <tt>:yield_returns_buffer => true</tt> will 
return the
 buffer captured by the block instead of the last expression in the block.
 
 = Reporting Bugs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile        2019-09-25 17:47:29.000000000 +0200
+++ new/Rakefile        2020-11-13 22:39:58.000000000 +0100
@@ -60,9 +60,7 @@
   
 desc "Run specs with -w, some warnings filtered"
 task "spec_w" do
-  ENV['RUBYOPT'] ? (ENV['RUBYOPT'] += " -w") : (ENV['RUBYOPT'] = '-w')
-  rake = ENV['RAKE'] || "#{FileUtils::RUBY} -S rake"
-  sh %{#{rake} 2>&1 | egrep -v \": warning: instance variable @.* not 
initialized|: warning: method redefined; discarding old|: warning: previous 
definition of|: warning: statement not reached"}
+  sh "#{FileUtils::RUBY} test/test_w.rb"
 end
 
 ### Other
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/erubi/capture_end.rb new/lib/erubi/capture_end.rb
--- old/lib/erubi/capture_end.rb        2019-09-25 17:47:29.000000000 +0200
+++ new/lib/erubi/capture_end.rb        2020-11-13 22:39:58.000000000 +0100
@@ -3,15 +3,15 @@
 require 'erubi'
 
 module Erubi
-  # An engine class that supports capturing blocks via the <%|= and <%|== tags,
-  # explicitly ending the captures using <%| end %> blocks.
+  # An engine class that supports capturing blocks via the <tt><%|=</tt> and 
<tt><%|==</tt> tags,
+  # explicitly ending the captures using <tt><%|</tt> end <tt>%></tt> blocks.
   class CaptureEndEngine < Engine
     # Initializes the engine.  Accepts the same arguments as ::Erubi::Engine, 
and these
     # additional options:
-    # :escape_capture :: Whether to make <%|= escape by default, and <%|== not 
escape by default,
+    # :escape_capture :: Whether to make <tt><%|=</tt> escape by default, and 
<tt><%|==</tt> not escape by default,
     #                    defaults to the same value as :escape.
-    # :yield_returns_buffer :: Whether to have <%| tags insert the buffer as 
an expression, so that
-    #                          <%| end %> tags will have the buffer be the 
last expression inside
+    # :yield_returns_buffer :: Whether to have <tt><%|</tt> tags insert the 
buffer as an expression, so that
+    #                          <tt><%| end %></tt> tags will have the buffer 
be the last expression inside
     #                          the block, and therefore have the buffer be 
returned by the yield
     #                          expression.  Normally the buffer will be 
returned anyway, but there
     #                          are cases where the last expression will not be 
the buffer,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/erubi.rb new/lib/erubi.rb
--- old/lib/erubi.rb    2019-09-25 17:47:29.000000000 +0200
+++ new/lib/erubi.rb    2020-11-13 22:39:58.000000000 +0100
@@ -1,34 +1,38 @@
 # frozen_string_literal: true
 
 module Erubi
-  VERSION = '1.9.0'
+  VERSION = '1.10.0'
   RANGE_ALL = 0..-1
 
+  # :nocov:
   if RUBY_VERSION >= '1.9'
     RANGE_FIRST = 0
     RANGE_LAST = -1
-    TEXT_END = RUBY_VERSION >= '2.1' ? "'.freeze;" : "';"
   else
-    # :nocov:
     RANGE_FIRST = 0..0
     RANGE_LAST = -1..-1
-    TEXT_END = "';"
   end
 
+  TEXT_END = RUBY_VERSION >= '2.1' ? "'.freeze;" : "';"
+  MATCH_METHOD = RUBY_VERSION >= '2.4' ? :match? : :match
+  # :nocov:
+
   begin
     require 'cgi/escape'
+    # :nocov:
     unless CGI.respond_to?(:escapeHTML) # work around for JRuby 9.1
       CGI = Object.new
       CGI.extend(defined?(::CGI::Escape) ? ::CGI::Escape : ::CGI::Util)
     end
+    # :nocov:
+    # Escape characters with their HTML/XML equivalents.
     def self.h(value)
       CGI.escapeHTML(value.to_s)
     end
   rescue LoadError
+    # :nocov:
     ESCAPE_TABLE = {'&' => '&amp;'.freeze, '<' => '&lt;'.freeze, '>' => 
'&gt;'.freeze, '"' => '&quot;'.freeze, "'" => '&#39;'.freeze}.freeze
     if RUBY_VERSION >= '1.9'
-      # Escape the following characters with their HTML/XML
-      # equivalents.
       def self.h(value)
         value.to_s.gsub(/[&<>"']/, ESCAPE_TABLE)
       end
@@ -37,6 +41,7 @@
         value.to_s.gsub(/[&<>"']/){|s| ESCAPE_TABLE[s]}
       end
     end
+    # :nocov:
   end
 
   class Engine
@@ -50,20 +55,22 @@
     attr_reader :bufvar
 
     # Initialize a new Erubi::Engine.  Options:
-    # :bufval :: The value to use for the buffer variable, as a string.
-    # :bufvar :: The variable name to use for the buffer variable, as a string 
(default '::String.new')
-    # :ensure :: Wrap the template in a begin/ensure block restoring the 
previous value of bufvar.
-    # :escapefunc :: The function to use for escaping, as a string (default: 
'::Erubi.h').
-    # :escape :: Whether to make <%= escape by default, and <%== not escape by 
default.
-    # :escape_html :: Same as :escape, with lower priority.
-    # :filename :: The filename for the template.
-    # :freeze :: Whether to enable frozen string literals in the resulting 
source code.
-    # :outvar :: Same as bufvar, with lower priority.
-    # :postamble :: The postamble for the template, by default returns the 
resulting source code.
-    # :preamble :: The preamble for the template, by default initializes up 
the buffer variable.
-    # :regexp :: The regexp to use for scanning.
-    # :src :: The initial value to use for the source code
-    # :trim :: Whether to trim leading and trailing whitespace, true by 
default.
+    # +:bufval+ :: The value to use for the buffer variable, as a string 
(default <tt>'::String.new'</tt>).
+    # +:bufvar+ :: The variable name to use for the buffer variable, as a 
string.
+    # +:ensure+ :: Wrap the template in a begin/ensure block restoring the 
previous value of bufvar.
+    # +:escapefunc+ :: The function to use for escaping, as a string (default: 
<tt>'::Erubi.h'</tt>).
+    # +:escape+ :: Whether to make <tt><%=</tt> escape by default, and 
<tt><%==</tt> not escape by default.
+    # +:escape_html+ :: Same as +:escape+, with lower priority.
+    # +:filename+ :: The filename for the template.
+    # +:freeze+ :: Whether to enable frozen string literals in the resulting 
source code.
+    # +:literal_prefix+ :: The prefix to output when using escaped tag 
delimiters (default <tt>'<%'</tt>).
+    # +:literal_postfix+ :: The postfix to output when using escaped tag 
delimiters (default <tt>'%>'</tt>).
+    # +:outvar+ :: Same as +:bufvar+, with lower priority.
+    # +:postamble+ :: The postamble for the template, by default returns the 
resulting source code.
+    # +:preamble+ :: The preamble for the template, by default initializes the 
buffer variable.
+    # +:regexp+ :: The regexp to use for scanning.
+    # +:src+ :: The initial value to use for the source code, an empty string 
by default.
+    # +:trim+ :: Whether to trim leading and trailing whitespace, true by 
default.
     def initialize(input, properties={})
       @escape = escape = 
properties.fetch(:escape){properties.fetch(:escape_html, false)}
       trim       = properties[:trim] != false
@@ -71,6 +78,8 @@
       @bufvar = bufvar = properties[:bufvar] || properties[:outvar] || "_buf"
       bufval = properties[:bufval] || '::String.new'
       regexp = properties[:regexp] || /<%(={1,2}|-|\#|%)?(.*?)([-=])?%>([ 
\t]*\r?\n)?/m
+      literal_prefix = properties[:literal_prefix] || '<%'
+      literal_postfix = properties[:literal_postfix] || '%>'
       preamble   = properties[:preamble] || "#{bufvar} = #{bufval};"
       postamble  = properties[:postamble] || "#{bufvar}.to_s\n"
 
@@ -110,46 +119,45 @@
             if rindex
               range = rindex+1..-1
               s = text[range]
-              if s =~ /\A[ \t]*\z/
+              if /\A[ \t]*\z/.send(MATCH_METHOD, s)
                 lspace = s
                 text[range] = ''
               end
             else
-              if is_bol && text =~ /\A[ \t]*\z/
-                lspace = text.dup
-                text[RANGE_ALL] = ''
+              if is_bol && /\A[ \t]*\z/.send(MATCH_METHOD, text)
+                lspace = text
+                text = ''
               end
             end
           end
         end
 
         is_bol = rspace
-        add_text(text) if text && !text.empty?
+        add_text(text)
         case ch
         when '='
           rspace = nil if tailch && !tailch.empty?
-          add_text(lspace) if lspace
           add_expression(indicator, code)
           add_text(rspace) if rspace
-        when '#'
-          n = code.count("\n") + (rspace ? 1 : 0)
+        when nil, '-'
           if trim && lspace && rspace
-            add_code("\n" * n)
+            add_code("#{lspace}#{code}#{rspace}")
           else
             add_text(lspace) if lspace
-            add_code("\n" * n)
+            add_code(code)
             add_text(rspace) if rspace
           end
-        when '%'
-          
add_text("#{lspace}#{prefix||='<%'}#{code}#{tailch}#{postfix||='%>'}#{rspace}")
-        when nil, '-'
+        when '#'
+          n = code.count("\n") + (rspace ? 1 : 0)
           if trim && lspace && rspace
-            add_code("#{lspace}#{code}#{rspace}")
+            add_code("\n" * n)
           else
             add_text(lspace) if lspace
-            add_code(code)
+            add_code("\n" * n)
             add_text(rspace) if rspace
           end
+        when '%'
+          
add_text("#{lspace}#{literal_prefix}#{code}#{tailch}#{literal_postfix}#{rspace}")
         else
           handle(indicator, code, tailch, rspace, lspace)
         end
@@ -159,16 +167,24 @@
 
       src << "\n" unless src[RANGE_LAST] == "\n"
       add_postamble(postamble)
-      src << "; ensure\n  #{bufvar} = __original_outvar\nend\n" if 
properties[:ensure]
+      src << "; ensure\n  " << bufvar << " = __original_outvar\nend\n" if 
properties[:ensure]
       src.freeze
       freeze
     end
 
     private
 
-    # Add raw text to the template
+    # Add raw text to the template.  Modifies argument if argument is mutable 
as a memory optimization.
+    # Must be called with a string, cannot be called with nil (Rails's 
subclass depends on it).
     def add_text(text)
-      @src << " #{@bufvar} << '" << text.gsub(/['\\]/, '\\\\\&') << TEXT_END 
unless text.empty?
+      return if text.empty?
+
+      if text.frozen?
+        text = text.gsub(/['\\]/, '\\\\\&')
+      else
+        text.gsub!(/['\\]/, '\\\\\&')
+      end
+      @src << " " << @bufvar << " << '" << text << TEXT_END
     end
 
     # Add ruby code to the template
@@ -189,12 +205,12 @@
 
     # Add the result of Ruby expression to the template
     def add_expression_result(code)
-      @src << " #{@bufvar} << (" << code << ').to_s;'
+      @src << ' ' << @bufvar << ' << (' << code << ').to_s;'
     end
 
     # Add the escaped result of Ruby expression to the template
     def add_expression_result_escaped(code)
-      @src << " #{@bufvar} << #{@escapefunc}((" << code << '));'
+      @src << ' ' << @bufvar << ' << ' << @escapefunc << '((' << code << '));'
     end
 
     # Add the given postamble to the src.  Can be overridden in subclasses
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2019-09-25 17:47:29.000000000 +0200
+++ new/metadata        2020-11-13 22:39:58.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: erubi
 version: !ruby/object:Gem::Version
-  version: 1.9.0
+  version: 1.10.0
 platform: ruby
 authors:
 - Jeremy Evans
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2019-09-25 00:00:00.000000000 Z
+date: 2020-11-13 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: minitest
@@ -54,11 +54,13 @@
 - Rakefile
 - lib/erubi.rb
 - lib/erubi/capture_end.rb
-- test/test.rb
 homepage: https://github.com/jeremyevans/erubi
 licenses:
 - MIT
-metadata: {}
+metadata:
+  bug_tracker_uri: https://github.com/jeremyevans/erubi/issues
+  changelog_uri: https://github.com/jeremyevans/erubi/blob/master/CHANGELOG
+  source_code_uri: https://github.com/jeremyevans/erubi
 post_install_message: 
 rdoc_options:
 - "--quiet"
@@ -81,7 +83,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.0.3
+rubygems_version: 3.1.4
 signing_key: 
 specification_version: 4
 summary: Small ERB Implementation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test.rb new/test/test.rb
--- old/test/test.rb    2019-09-25 17:47:29.000000000 +0200
+++ new/test/test.rb    1970-01-01 01:00:00.000000000 +0100
@@ -1,780 +0,0 @@
-require 'rubygems'
-
-unless defined?(TESTDIR)
-  TESTDIR = File.dirname(__FILE__)
-  LIBDIR  = TESTDIR == '.' ? '../lib' : File.dirname(TESTDIR) + '/lib'
-  $: << TESTDIR
-  $: << LIBDIR
-end
-
-if ENV['COVERAGE']
-  require 'coverage'
-  require 'simplecov'
-
-  ENV.delete('COVERAGE')
-  SimpleCov.instance_eval do
-    start do
-      add_filter "/test/"
-      add_group('Missing'){|src| src.covered_percent < 100}
-      add_group('Covered'){|src| src.covered_percent == 100}
-    end
-  end
-end
-
-require 'erubi'
-require 'erubi/capture_end'
-
-ENV['MT_NO_PLUGINS'] = '1' # Work around stupid autoloading of plugins
-gem 'minitest'
-require 'minitest/global_expectations/autorun'
-
-describe Erubi::Engine do
-  before do
-    @options = {}
-  end
-
-  def check_output(input, src, result, &block)
-    t = (@options[:engine] || Erubi::Engine).new(input, @options)
-    tsrc = t.src
-    eval(tsrc, block.binding).must_equal result
-    tsrc = tsrc.gsub("'.freeze;", "';") if RUBY_VERSION >= '2.1'
-    tsrc.must_equal src
-  end
-
-  def setup_foo
-    @foo = Object.new
-    @foo.instance_variable_set(:@t, self)
-    def self.a; @a; end
-    def @foo.bar
-      @t.a << "a"
-      yield
-      @t.a << 'b'
-      @t.a.buffer.upcase!
-    end
-  end
-
-  def setup_bar
-    def self.bar
-      @a << "a"
-      yield
-      @a << 'b'
-      @a.upcase
-    end
-    def self.baz
-      @a << "c"
-      yield
-      @a << 'd'
-      @a * 2
-    end
-    def self.quux
-      @a << "a"
-      3.times do |i|
-        @a << "c#{i}"
-        yield i
-        @a << "d#{i}"
-      end
-      @a << "b"
-      @a.upcase
-    end
-  end
-
-  it "should handle no options" do
-    list = ['&\'<>"2']
-    check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <% i = 0
-     list.each_with_index do |item, i| %>
-  <tr>
-   <td><%= i+1 %></td>
-   <td><%== item %></td>
-  </tr>
- <% end %>
- </tbody>
-</table>
-<%== i+1 %>
-END1
-_buf = ::String.new; _buf << '<table>
- <tbody>
-';   i = 0
-     list.each_with_index do |item, i| 
- _buf << '  <tr>
-   <td>'; _buf << ( i+1 ).to_s; _buf << '</td>
-   <td>'; _buf << ::Erubi.h(( item )); _buf << '</td>
-  </tr>
-';  end 
- _buf << ' </tbody>
-</table>
-'; _buf << ::Erubi.h(( i+1 )); _buf << '
-';
-_buf.to_s
-END2
-<table>
- <tbody>
-  <tr>
-   <td>1</td>
-   <td>&amp;&#39;&lt;&gt;&quot;2</td>
-  </tr>
- </tbody>
-</table>
-1
-END3
-  end
-
-  it "should strip only whitespace for <%, <%- and <%# tags" do
-    check_output(<<END1, <<END2, <<END3){}
-  <% 1 %>  
-a
-  <%- 2 %>  
-b
-  <%# 3 %>  
-c
- /<% 1 %>  
-a
-/ <%- 2 %>  
-b
-//<%# 3 %>  
-c
-  <% 1 %> /
-a
-  <%- 2 %>/ 
-b
-  <%# 3 %>//
-c
-END1
-_buf = ::String.new;   1   
- _buf << 'a
-';   2   
- _buf << 'b
-';
- _buf << 'c
- /'; 1 ; _buf << '  
-'; _buf << 'a
-/ '; 2 ; _buf << '  
-'; _buf << 'b
-//';
- _buf << '  
-'; _buf << 'c
-'; _buf << '  '; 1 ; _buf << ' /
-a
-'; _buf << '  '; 2 ; _buf << '/ 
-b
-'; _buf << '  ';; _buf << '//
-c
-';
-_buf.to_s
-END2
-a
-b
-c
- /  
-a
-/   
-b
-//  
-c
-   /
-a
-  / 
-b
-  //
-c
-END3
-  end
-
-  it "should handle ensure option" do
-    list = ['&\'<>"2']
-    @options[:ensure] = true
-    @options[:bufvar] = '@a'
-    @a = 'bar'
-    check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <% i = 0
-     list.each_with_index do |item, i| %>
-  <tr>
-   <td><%= i+1 %></td>
-   <td><%== item %></td>
-  </tr>
- <% end %>
- </tbody>
-</table>
-<%== i+1 %>
-END1
-begin; __original_outvar = @a if defined?(@a); @a = ::String.new; @a << 
'<table>
- <tbody>
-';   i = 0
-     list.each_with_index do |item, i| 
- @a << '  <tr>
-   <td>'; @a << ( i+1 ).to_s; @a << '</td>
-   <td>'; @a << ::Erubi.h(( item )); @a << '</td>
-  </tr>
-';  end 
- @a << ' </tbody>
-</table>
-'; @a << ::Erubi.h(( i+1 )); @a << '
-';
-@a.to_s
-; ensure
-  @a = __original_outvar
-end
-END2
-<table>
- <tbody>
-  <tr>
-   <td>1</td>
-   <td>&amp;&#39;&lt;&gt;&quot;2</td>
-  </tr>
- </tbody>
-</table>
-1
-END3
-    @a.must_equal 'bar'
-  end
-
-  it "should have <%|= with CaptureEndEngine not escape by default" do
-    eval(::Erubi::CaptureEndEngine.new('<%|= "&" %><%| %>').src).must_equal '&'
-    eval(::Erubi::CaptureEndEngine.new('<%|= "&" %><%| %>', 
:escape=>false).src).must_equal '&'
-    eval(::Erubi::CaptureEndEngine.new('<%|= "&" %><%| %>', 
:escape_capture=>false).src).must_equal '&'
-    eval(::Erubi::CaptureEndEngine.new('<%|= "&" %><%| %>', 
:escape=>true).src).must_equal '&amp;'
-    eval(::Erubi::CaptureEndEngine.new('<%|= "&" %><%| %>', 
:escape_capture=>true).src).must_equal '&amp;'
-  end
-
-  it "should have <%|== with CaptureEndEngine escape by default" do
-    eval(::Erubi::CaptureEndEngine.new('<%|== "&" %><%| %>').src).must_equal 
'&amp;'
-    eval(::Erubi::CaptureEndEngine.new('<%|== "&" %><%| %>', 
:escape=>true).src).must_equal '&'
-    eval(::Erubi::CaptureEndEngine.new('<%|== "&" %><%| %>', 
:escape_capture=>true).src).must_equal '&'
-    eval(::Erubi::CaptureEndEngine.new('<%|== "&" %><%| %>', 
:escape=>false).src).must_equal '&amp;'
-    eval(::Erubi::CaptureEndEngine.new('<%|== "&" %><%| %>', 
:escape_capture=>false).src).must_equal '&amp;'
-  end
-
-  [['', false], ['=', true]].each do |ind, escape|
-    it "should allow <%|=#{ind} and <%| for capturing with CaptureEndEngine 
with :escape_capture => #{escape} and :escape => #{!escape}" do
-      @options[:bufvar] = '@a'
-      @options[:capture] = true
-      @options[:escape_capture] = escape
-      @options[:escape] = !escape
-      @options[:engine] = ::Erubi::CaptureEndEngine
-      setup_bar
-      check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <%|=#{ind} bar do %>
-   <b><%=#{ind} '&' %></b>
- <%| end %>
- </tbody>
-</table>
-END1
-#{'__erubi = ::Erubi;' unless escape}@a = ::String.new; @a << '<table>
- <tbody>
-'; @a << '  ';begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << (( bar do  @a << '
-'; @a << '   <b>'; @a << #{!escape ? '__erubi' : '::Erubi'}.h(( '&' )); @a << 
'</b>
-'; @a << ' '; end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-'; @a << ' </tbody>
-</table>
-';
-@a.to_s
-END2
-<table>
- <tbody>
-  A
-   <B>&AMP;</B>
- B
- </tbody>
-</table>
-END3
-    end
-  end
-
-  [['', true], ['=', false]].each do |ind, escape|
-    it "should allow <%|=#{ind} and <%| for capturing with CaptureEndEngine 
when with :escape => #{escape}" do
-      @options[:bufvar] = '@a'
-      @options[:escape] = escape
-      @options[:engine] = ::Erubi::CaptureEndEngine
-      setup_bar
-      check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <%|=#{ind} bar do %>
-   <b><%=#{ind} '&' %></b>
- <%| end %>
- </tbody>
-</table>
-END1
-#{'__erubi = ::Erubi;' if escape}@a = ::String.new; @a << '<table>
- <tbody>
-'; @a << '  ';begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << #{escape ? '__erubi' : '::Erubi'}.h(( bar do  @a << '
-'; @a << '   <b>'; @a << #{escape ? '__erubi' : '::Erubi'}.h(( '&' )); @a << 
'</b>
-'; @a << ' '; end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-'; @a << ' </tbody>
-</table>
-';
-@a.to_s
-END2
-<table>
- <tbody>
-  A
-   &lt;B&gt;&amp;AMP;&lt;/B&gt;
- B
- </tbody>
-</table>
-END3
-    end
-
-    it "should handle loops in <%|=#{ind} and <%| for capturing with 
CaptureEndEngine when with :escape => #{escape}" do
-      @options[:bufvar] = '@a'
-      @options[:escape] = escape
-      @options[:engine] = ::Erubi::CaptureEndEngine
-      setup_bar
-      check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <%|=#{ind} quux do |i| %>
-   <b><%=#{ind} "\#{i}&" %></b>
- <%| end %>
- </tbody>
-</table>
-END1
-#{'__erubi = ::Erubi;' if escape}@a = ::String.new; @a << '<table>
- <tbody>
-'; @a << '  ';begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << #{escape ? '__erubi' : '::Erubi'}.h(( quux do |i|  @a << '
-'; @a << '   <b>'; @a << #{escape ? '__erubi' : '::Erubi'}.h(( "\#{i}&" )); @a 
<< '</b>
-'; @a << ' '; end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-'; @a << ' </tbody>
-</table>
-';
-@a.to_s
-END2
-<table>
- <tbody>
-  AC0
-   &lt;B&gt;0&amp;AMP;&lt;/B&gt;
- D0C1
-   &lt;B&gt;1&amp;AMP;&lt;/B&gt;
- D1C2
-   &lt;B&gt;2&amp;AMP;&lt;/B&gt;
- D2B
- </tbody>
-</table>
-END3
-    end
-
-    it "should allow <%|=#{ind} and <%| for nested capturing with 
CaptureEndEngine when with :escape => #{escape}" do
-      @options[:bufvar] = '@a'
-      @options[:escape] = escape
-      @options[:engine] = ::Erubi::CaptureEndEngine
-      setup_bar
-      check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <%|=#{ind} bar do %>
-   <b><%=#{ind} '&' %></b>
-   <%|=#{ind} baz do %>e<%| end %>
- <%| end %>
- </tbody>
-</table>
-END1
-#{'__erubi = ::Erubi;' if escape}@a = ::String.new; @a << '<table>
- <tbody>
-'; @a << '  ';begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << #{escape ? '__erubi' : '::Erubi'}.h(( bar do  @a << '
-'; @a << '   <b>'; @a << #{escape ? '__erubi' : '::Erubi'}.h(( '&' )); @a << 
'</b>
-'; @a << '   ';begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << #{escape ? '__erubi' : '::Erubi'}.h(( baz do  @a << 'e'; 
end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-'; @a << ' '; end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-'; @a << ' </tbody>
-</table>
-';
-@a.to_s
-END2
-<table>
- <tbody>
-  A
-   &lt;B&gt;&amp;AMP;&lt;/B&gt;
-   CEDCED
- B
- </tbody>
-</table>
-END3
-    end
-  end
-
-  [:outvar, :bufvar].each do |var|
-    it "should handle :#{var} and :freeze options" do
-      @options[var] = "@_out_buf"
-      @options[:freeze] = true
-      @items = [2]
-      i = 0
-      check_output(<<END1, <<END2, <<END3){}
-<table>
-  <% for item in @items %>
-  <tr>
-    <td><%= i+1 %></td>
-    <td><%== item %></td>
-  </tr>
-  <% end %>
-</table>
-END1
-# frozen_string_literal: true
-@_out_buf = ::String.new; @_out_buf << '<table>
-';   for item in @items 
- @_out_buf << '  <tr>
-    <td>'; @_out_buf << ( i+1 ).to_s; @_out_buf << '</td>
-    <td>'; @_out_buf << ::Erubi.h(( item )); @_out_buf << '</td>
-  </tr>
-';   end 
- @_out_buf << '</table>
-';
-@_out_buf.to_s
-END2
-<table>
-  <tr>
-    <td>1</td>
-    <td>2</td>
-  </tr>
-</table>
-END3
-    end
-  end
-
-  it "should handle <%% and <%# syntax" do
-    @items = [2]
-    i = 0
-    check_output(<<END1, <<END2, <<END3){}
-<table>
-<%% for item in @items %>
-  <tr>
-    <td><%# i+1 %></td>
-    <td><%# item %></td>
-  </tr>
-  <%% end %>
-</table>
-END1
-_buf = ::String.new; _buf << '<table>
-'; _buf << '<% for item in @items %>
-'; _buf << '  <tr>
-    <td>';; _buf << '</td>
-    <td>';; _buf << '</td>
-  </tr>
-'; _buf << '  <% end %>
-'; _buf << '</table>
-';
-_buf.to_s
-END2
-<table>
-<% for item in @items %>
-  <tr>
-    <td></td>
-    <td></td>
-  </tr>
-  <% end %>
-</table>
-END3
-  end
-
-  it "should handle :trim => false option" do
-    @options[:trim] = false
-    @items = [2]
-    i = 0
-    check_output(<<END1, <<END2, <<END3){}
-<table>
-  <% for item in @items %>
-  <tr>
-    <td><%# 
-    i+1
-    %></td>
-    <td><%== item %></td>
-  </tr>
-  <% end %><%#%>
-  <% i %>a
-  <% i %>
-</table>
-END1
-_buf = ::String.new; _buf << '<table>
-'; _buf << '  '; for item in @items ; _buf << '
-'; _buf << '  <tr>
-    <td>';
-
- _buf << '</td>
-    <td>'; _buf << ::Erubi.h(( item )); _buf << '</td>
-  </tr>
-'; _buf << '  '; end ;
- _buf << '
-'; _buf << '  '; i ; _buf << 'a
-'; _buf << '  '; i ; _buf << '
-'; _buf << '</table>
-';
-_buf.to_s
-END2
-<table>
-  
-  <tr>
-    <td></td>
-    <td>2</td>
-  </tr>
-  
-  a
-  
-</table>
-END3
-  end
-
-  [:escape, :escape_html].each do  |opt|
-    it "should handle :#{opt} and :escapefunc options" do
-      @options[opt] = true
-      @options[:escapefunc] = 'h.call'
-      h = proc{|s| s.to_s*2}
-      list = ['2']
-      check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <% i = 0
-     list.each_with_index do |item, i| %>
-  <tr>
-   <td><%= i+1 %></td>
-   <td><%== item %></td>
-  </tr>
- <% end %>
- </tbody>
-</table>
-<%== i+1 %>
-END1
-_buf = ::String.new; _buf << '<table>
- <tbody>
-';   i = 0
-     list.each_with_index do |item, i| 
- _buf << '  <tr>
-   <td>'; _buf << h.call(( i+1 )); _buf << '</td>
-   <td>'; _buf << ( item ).to_s; _buf << '</td>
-  </tr>
-';  end 
- _buf << ' </tbody>
-</table>
-'; _buf << ( i+1 ).to_s; _buf << '
-';
-_buf.to_s
-END2
-<table>
- <tbody>
-  <tr>
-   <td>11</td>
-   <td>2</td>
-  </tr>
- </tbody>
-</table>
-1
-END3
-    end
-  end
-
-  it "should handle :escape option without :escapefunc option" do
-    @options[:escape] = true
-    list = ['&\'<>"2']
-    check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <% i = 0
-     list.each_with_index do |item, i| %>
-  <tr>
-   <td><%== i+1 %></td>
-   <td><%= item %></td>
-  </tr>
- <% end %>
- </tbody>
-</table>
-END1
-__erubi = ::Erubi;_buf = ::String.new; _buf << '<table>
- <tbody>
-';   i = 0
-     list.each_with_index do |item, i| 
- _buf << '  <tr>
-   <td>'; _buf << ( i+1 ).to_s; _buf << '</td>
-   <td>'; _buf << __erubi.h(( item )); _buf << '</td>
-  </tr>
-';  end 
- _buf << ' </tbody>
-</table>
-';
-_buf.to_s
-END2
-<table>
- <tbody>
-  <tr>
-   <td>1</td>
-   <td>&amp;&#39;&lt;&gt;&quot;2</td>
-  </tr>
- </tbody>
-</table>
-END3
-  end
-
-  it "should handle :preamble and :postamble options" do
-    @options[:preamble] = '_buf = String.new("1");'
-    @options[:postamble] = "_buf[0...18]\n"
-    list = ['2']
-    check_output(<<END1, <<END2, <<END3){}
-<table>
- <tbody>
-  <% i = 0
-     list.each_with_index do |item, i| %>
-  <tr>
-   <td><%= i+1 %></td>
-   <td><%== item %></td>
-  </tr>
- <% end %>
- </tbody>
-</table>
-<%== i+1 %>
-END1
-_buf = String.new("1"); _buf << '<table>
- <tbody>
-';   i = 0
-     list.each_with_index do |item, i| 
- _buf << '  <tr>
-   <td>'; _buf << ( i+1 ).to_s; _buf << '</td>
-   <td>'; _buf << ::Erubi.h(( item )); _buf << '</td>
-  </tr>
-';  end 
- _buf << ' </tbody>
-</table>
-'; _buf << ::Erubi.h(( i+1 )); _buf << '
-';
-_buf[0...18]
-END2
-1<table>
- <tbody>
-END3
-  end
-
-  it "should have working filename accessor" do
-    Erubi::Engine.new('', :filename=>'foo.rb').filename.must_equal 'foo.rb'
-  end
-
-  it "should have working bufvar accessor" do
-    Erubi::Engine.new('', :bufvar=>'foo').bufvar.must_equal 'foo'
-    Erubi::Engine.new('', :outvar=>'foo').bufvar.must_equal 'foo'
-  end
-
-  it "should work with BasicObject methods" do
-    c = Class.new(BasicObject)
-    c.class_eval("def a; #{Erubi::Engine.new('2').src} end")
-    c.new.a.must_equal '2'
-  end if defined?(BasicObject)
-
-  it "should return frozen object" do
-    Erubi::Engine.new('').frozen?.must_equal true
-  end
-
-  it "should have frozen src" do
-    Erubi::Engine.new('').src.frozen?.must_equal true
-  end
-
-  it "should raise an error if a tag is not handled when a custom regexp is 
used" do
-    proc{Erubi::Engine.new('<%] %>', :regexp 
=>/<%(={1,2}|\]|-|\#|%)?(.*?)([-=])?%>([ \t]*\r?\n)?/m)}.must_raise 
ArgumentError
-    proc{Erubi::CaptureEndEngine.new('<%] %>', :regexp 
=>/<%(={1,2}|\]|-|\#|%)?(.*?)([-=])?%>([ \t]*\r?\n)?/m)}.must_raise 
ArgumentError
-  end
-
-  it "should respect the :yield_returns_buffer option for making templates 
return the (potentially modified) buffer" do
-    @options[:engine] = ::Erubi::CaptureEndEngine
-    @options[:bufvar] = '@a'
-
-    def self.bar
-      a = String.new
-      a << "a"
-      yield 'burgers'
-      case b = (yield 'salads')
-      when String
-        a << b
-        a << 'b'
-        a.upcase
-      end
-    end
-
-    check_output(<<END1, <<END2, <<END3){}
-<%|= bar do |item| %>
-Let's eat <%= item %>!
-<% nil %><%| end %>
-END1
-@a = ::String.new;begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << (( bar do |item|  @a << '
-'; @a << 'Let\\'s eat '; @a << ( item ).to_s; @a << '!
-'; nil ; end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-';
-@a.to_s
-END2
-
-END3
-
-    @options[:yield_returns_buffer] = true
-
-    check_output(<<END1, <<END2, <<END3) {}
-<%|= bar do |item| %>
-Let's eat <%= item %>!
-<% nil %><%| end %>
-END1
-@a = ::String.new;begin; (__erubi_stack ||= []) << @a; @a = ::String.new; 
__erubi_stack.last << (( bar do |item|  @a << '
-'; @a << 'Let\\'s eat '; @a << ( item ).to_s; @a << '!
-'; nil ; @a;  end )).to_s; ensure; @a = __erubi_stack.pop; end; @a << '
-';
-@a.to_s
-END2
-A
-LET'S EAT BURGERS!
-
-LET'S EAT SALADS!
-B
-END3
-  end
-
-  it "should respect the :yield_returns_buffer option for making templates 
return the (potentially modified) buffer as the result of the block" do
-    @options[:engine] = ::Erubi::CaptureEndEngine
-    @options[:yield_returns_buffer] = true
-
-    def self.bar(foo = nil)
-      if foo.nil?
-        yield
-      else
-        foo
-      end
-    end
-
-    check_output(<<END1, <<END2, <<END3) {}
-<%|= bar do %>
-Let's eat the tacos!
-<%| end %>
-
-Delicious!
-END1
-_buf = ::String.new;begin; (__erubi_stack ||= []) << _buf; _buf = 
::String.new; __erubi_stack.last << (( bar do  _buf << '
-'; _buf << 'Let\\'s eat the tacos!
-'; _buf;  end )).to_s; ensure; _buf = __erubi_stack.pop; end; _buf << '
-'; _buf << '
-Delicious!
-';
-_buf.to_s
-END2
-
-Let's eat the tacos!
-
-
-Delicious!
-END3
-
-    check_output(<<END1, <<END2, <<END3) {}
-<%|= bar("Don't eat the burgers!") do %>
-Let's eat burgers!
-<%| end %>
-
-Delicious!
-END1
-_buf = ::String.new;begin; (__erubi_stack ||= []) << _buf; _buf = 
::String.new; __erubi_stack.last << (( bar(\"Don't eat the burgers!\") do  _buf 
<< '
-'; _buf << 'Let\\'s eat burgers!
-'; _buf;  end )).to_s; ensure; _buf = __erubi_stack.pop; end; _buf << '
-'; _buf << '
-Delicious!
-';
-_buf.to_s
-END2
-Don't eat the burgers!
-
-Delicious!
-END3
-  end
-end
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to