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 6
6
ruby-versions :
7
7
uses : ruby/actions/.github/workflows/ruby_versions.yml@master
8
8
with :
9
- engine : cruby-jruby
10
9
min_version : 2.5
11
10
test :
12
11
needs : ruby-versions
22
21
- { os: windows-latest, ruby: jruby }
23
22
- { os: macos-latest, ruby: jruby-head }
24
23
- { os: windows-latest, ruby: jruby-head }
24
+ - { os: windows-latest, ruby: truffleruby }
25
+ - { os: windows-latest, ruby: truffleruby-head }
25
26
include :
26
27
- { os: windows-latest, ruby: mingw }
27
28
- { 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|
11
11
task :build => :compile
12
12
end
13
13
14
- unless RUBY_ENGINE == 'jruby '
14
+ if RUBY_ENGINE == 'ruby '
15
15
require 'rake/extensiontask'
16
16
extask = Rake ::ExtensionTask . new ( "cgi/escape" ) do |x |
17
17
x . lib_dir . sub! ( %r[(?=/|\z )] , "/#{ RUBY_VERSION } /#{ x . platform } " )
@@ -22,7 +22,7 @@ Rake::TestTask.new(:test) do |t|
22
22
t . libs << "test/lib"
23
23
if RUBY_ENGINE == 'jruby'
24
24
t . libs << "ext/java/org/jruby/ext/cgi/escape/lib"
25
- else
25
+ elsif RUBY_ENGINE == 'ruby'
26
26
t . libs << "lib/#{ RUBY_VERSION } /#{ extask . platform } "
27
27
end
28
28
t . ruby_opts << "-rhelper"
Original file line number Diff line number Diff line change 1
1
require 'mkmf'
2
2
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)
90
90
end
91
91
end
92
92
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
96
99
end
97
100
98
101
# Unescape a string that has been HTML-escaped
Original file line number Diff line number Diff line change @@ -262,7 +262,7 @@ def setup
262
262
remove_method :escapeHTML
263
263
alias _unescapeHTML unescapeHTML
264
264
remove_method :unescapeHTML
265
- end
265
+ end if defined? ( CGI :: Escape )
266
266
end
267
267
268
268
def teardown
@@ -271,7 +271,7 @@ def teardown
271
271
remove_method :_escapeHTML
272
272
alias unescapeHTML _unescapeHTML
273
273
remove_method :_unescapeHTML
274
- end
274
+ end if defined? ( CGI :: Escape )
275
275
end
276
276
277
277
def test_cgi_escapeHTML_with_invalid_byte_sequence
You can’t perform that action at this time.
0 commit comments