File tree Expand file tree Collapse file tree 5 files changed +17
-9
lines changed
Expand file tree Collapse file tree 5 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 66 ruby-versions :
77 uses : ruby/actions/.github/workflows/ruby_versions.yml@master
88 with :
9- engine : cruby-jruby
109 min_version : 2.5
1110 test :
1211 needs : ruby-versions
2221 - { os: windows-latest, ruby: jruby }
2322 - { os: macos-latest, ruby: jruby-head }
2423 - { os: windows-latest, ruby: jruby-head }
24+ - { os: windows-latest, ruby: truffleruby }
25+ - { os: windows-latest, ruby: truffleruby-head }
2526 include :
2627 - { os: windows-latest, ruby: mingw }
2728 - { os: windows-latest, ruby: mswin }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Rake::JavaExtensionTask.new("escape") do |ext|
1111 task :build => :compile
1212end
1313
14- unless RUBY_ENGINE == 'jruby '
14+ if RUBY_ENGINE == 'ruby '
1515 require 'rake/extensiontask'
1616 extask = Rake ::ExtensionTask . new ( "cgi/escape" ) do |x |
1717 x . lib_dir . sub! ( %r[(?=/|\z )] , "/#{ RUBY_VERSION } /#{ x . platform } " )
@@ -22,7 +22,7 @@ Rake::TestTask.new(:test) do |t|
2222 t . libs << "test/lib"
2323 if RUBY_ENGINE == 'jruby'
2424 t . libs << "ext/java/org/jruby/ext/cgi/escape/lib"
25- else
25+ elsif RUBY_ENGINE == 'ruby'
2626 t . libs << "lib/#{ RUBY_VERSION } /#{ extask . platform } "
2727 end
2828 t . ruby_opts << "-rhelper"
Original file line number Diff line number Diff line change 11require 'mkmf'
22
3- create_makefile 'cgi/escape'
3+ if RUBY_ENGINE == 'truffleruby'
4+ File . write ( "Makefile" , dummy_makefile ( $srcdir) . join ( "" ) )
5+ else
6+ create_makefile 'cgi/escape'
7+ end
Original file line number Diff line number Diff line change @@ -90,9 +90,12 @@ def escapeHTML(string)
9090 end
9191 end
9292
93- begin
94- require 'cgi/escape'
95- rescue LoadError
93+ # TruffleRuby runs the pure-Ruby variant faster, do not use the C extension there
94+ unless RUBY_ENGINE == 'truffleruby'
95+ begin
96+ require 'cgi/escape'
97+ rescue LoadError
98+ end
9699 end
97100
98101 # Unescape a string that has been HTML-escaped
Original file line number Diff line number Diff line change @@ -262,7 +262,7 @@ def setup
262262 remove_method :escapeHTML
263263 alias _unescapeHTML unescapeHTML
264264 remove_method :unescapeHTML
265- end
265+ end if defined? ( CGI :: Escape )
266266 end
267267
268268 def teardown
@@ -271,7 +271,7 @@ def teardown
271271 remove_method :_escapeHTML
272272 alias unescapeHTML _unescapeHTML
273273 remove_method :_unescapeHTML
274- end
274+ end if defined? ( CGI :: Escape )
275275 end
276276
277277 def test_cgi_escapeHTML_with_invalid_byte_sequence
You can’t perform that action at this time.
0 commit comments