Skip to content

Commit a63acc0

Browse files
committed
Only run encoding tests on CRuby
1 parent bb73801 commit a63acc0

File tree

2 files changed

+53
-34
lines changed

2 files changed

+53
-34
lines changed

docs/encoding.md

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,56 @@ If the file is not encoded in UTF-8, the user must specify the encoding in a "ma
1212

1313
The key of the comment can be either "encoding" or "coding". The value of the comment must be a string that is a valid encoding name. The encodings that prism supports by default are:
1414

15-
* `ascii`
16-
* `ascii-8bit`
17-
* `big5`
18-
* `binary`
19-
* `cp932`
20-
* `euc-jp`
21-
* `gbk`
22-
* `iso-8859-1`
23-
* `iso-8859-2`
24-
* `iso-8859-3`
25-
* `iso-8859-4`
26-
* `iso-8859-5`
27-
* `iso-8859-6`
28-
* `iso-8859-7`
29-
* `iso-8859-8`
30-
* `iso-8859-9`
31-
* `iso-8859-10`
32-
* `iso-8859-11`
33-
* `iso-8859-13`
34-
* `iso-8859-14`
35-
* `iso-8859-15`
36-
* `iso-8859-16`
37-
* `koi8-r`
38-
* `shift_jis`
39-
* `sjis`
40-
* `us-ascii`
41-
* `utf-8`
42-
* `utf8-mac`
43-
* `windows-31j`
44-
* `windows-1250`
45-
* `windows-1251`
46-
* `windows-1252`
15+
* `ASCII-8BIT`
16+
* `Big5`
17+
* `CP51932`
18+
* `CP850`
19+
* `CP852`
20+
* `CP855`
21+
* `EUC-JP`
22+
* `GBK`
23+
* `IBM437`
24+
* `IBM720`
25+
* `IBM737`
26+
* `IBM775`
27+
* `IBM852`
28+
* `IBM855`
29+
* `IBM857`
30+
* `IBM860`
31+
* `IBM861`
32+
* `IBM862`
33+
* `ISO-8859-1`
34+
* `ISO-8859-2`
35+
* `ISO-8859-3`
36+
* `ISO-8859-4`
37+
* `ISO-8859-5`
38+
* `ISO-8859-6`
39+
* `ISO-8859-7`
40+
* `ISO-8859-8`
41+
* `ISO-8859-9`
42+
* `ISO-8859-10`
43+
* `ISO-8859-11`
44+
* `ISO-8859-13`
45+
* `ISO-8859-14`
46+
* `ISO-8859-15`
47+
* `ISO-8859-16`
48+
* `KOI8-R`
49+
* `Shift_JIS`
50+
* `US-ASCII`
51+
* `UTF-8`
52+
* `UTF8-MAC`
53+
* `Windows-1250`
54+
* `Windows-1251`
55+
* `Windows-1252`
56+
* `Windows-1253`
57+
* `Windows-1254`
58+
* `Windows-1255`
59+
* `Windows-1256`
60+
* `Windows-1257`
61+
* `Windows-1258`
62+
* `Windows-31J`
63+
* `macIceland`
64+
* `macRomania`
4765

4866
For each of these encodings, prism provides a function for checking if the subsequent bytes form an alphabetic or alphanumeric character.
4967

test/prism/encoding_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
return if RUBY_ENGINE != "ruby"
4+
35
require_relative "test_helper"
46

57
module Prism
@@ -85,7 +87,6 @@ def test_coding_with_whitespace
8587
assert_equal Encoding.find("ascii-8bit"), actual
8688
end
8789

88-
8990
def test_emacs_style
9091
result = Prism.parse("# -*- coding: utf-8 -*-\n'string'")
9192
actual = result.value.statements.body.first.unescaped.encoding
@@ -200,7 +201,7 @@ def assert_encoding(encoding, name, range)
200201

201202
range.each do |codepoint|
202203
character = codepoint.chr(encoding)
203-
204+
204205
if character.match?(/[[:alpha:]]/)
205206
if character.match?(/[[:upper:]]/)
206207
assert_encoding_constant(name, character)

0 commit comments

Comments
 (0)