[PRISM] Set eval encoding based on string encoding

This commit is contained in:
Kevin Newton 2024-02-13 21:38:30 -05:00
Родитель 7177731282
Коммит fc2c128e7e
7 изменённых файлов: 8 добавлений и 8 удалений

2
.github/workflows/prism.yml поставляемый
Просмотреть файл

@ -90,7 +90,7 @@ jobs:
timeout-minutes: 40
env:
GNUMAKEFLAGS: ''
RUBY_TESTOPTS: '-q --tty=no --excludes-dir="../src/test/.excludes-prism" --exclude="test_ast.rb" --exclude="test_marshal.rb" --exclude="test_regexp.rb" --exclude="error_highlight/test_error_highlight.rb" --exclude="irb/test_context.rb" --exclude="prism/encoding_test.rb" --exclude="prism/unescape_test.rb"'
RUBY_TESTOPTS: '-q --tty=no --excludes-dir="../src/test/.excludes-prism" --exclude="test_ast.rb" --exclude="test_regexp.rb" --exclude="error_highlight/test_error_highlight.rb" --exclude="irb/test_context.rb" --exclude="prism/encoding_test.rb" --exclude="prism/unescape_test.rb"'
RUN_OPTS: ${{ matrix.run_opts }}
# - name: make test-spec

Просмотреть файл

@ -8254,6 +8254,10 @@ VALUE
pm_parse_string(pm_parse_result_t *result, VALUE source, VALUE filepath)
{
pm_string_constant_init(&result->input, RSTRING_PTR(source), RSTRING_LEN(source));
rb_encoding *encoding = rb_enc_get(source);
pm_options_encoding_set(&result->options, rb_enc_name(encoding));
return pm_parse_input(result, filepath);
}

Просмотреть файл

@ -2,3 +2,4 @@ exclude(:test_def_method_with_fname, "unknown")
exclude(:test_def_method_without_filename, "unknown")
exclude(:test_keep_lineno, "unknown")
exclude(:test_multi_line_comment_lineno, "unknown")
exclude(:test_require_nonascii_path_shift_jis, "unknown")

Просмотреть файл

@ -1,5 +1,3 @@
exclude(:test_eval_ascii_incompatible, "incorrect encoding")
exclude(:test_eval_location_binding, "incorrect line number")
exclude(:test_file_encoding, "incorrect encoding")
exclude(:test_with_filename_and_safe_level, "incorrect line number")
exclude(:test_with_filename_lineno, "incorrect line number")

Просмотреть файл

@ -1,7 +1,4 @@
exclude(:test_assign_in_conditional, "missing warning")
exclude(:test_eval_ascii_incompatible, "unknown")
exclude(:test_eval_location_binding, "incorrect line number")
exclude(:test_file_encoding, "unknown")
exclude(:test_here_document, "incorrect heredoc")
exclude(:test_literal_in_conditional, "missing warning")
exclude(:test_magic_comment, "incorrect encoding")
@ -9,7 +6,6 @@ exclude(:test_negative_line_number, "incorrect line number")
exclude(:test_nonascii_const_set, "incorrect encoding")
exclude(:test_nonascii_constant, "incorrect encoding")
exclude(:test_question, "missing warning")
exclude(:test_redefinition_mismatch, "unknown")
exclude(:test_serial_comparison, "missing warning")
exclude(:test_shareable_constant_value_nested, "ractor support")
exclude(:test_shareable_constant_value_nonliteral, "ractor support")

Просмотреть файл

@ -1 +1 @@
exclude(:test_require_nonascii_path_shift_jis, "unknown")
exclude(:test_require_nonascii_path_shift_jis, "encoding")

Просмотреть файл

@ -1,4 +1,5 @@
exclude(:test_dregexp, "unknown")
exclude(:test_dstring_encoding, "incorrect encoding")
exclude(:test_float, "numbered parameters inside evals")
exclude(:test_frozen_string_in_array_literal, "incorrect frozen value")
exclude(:test_hash_duplicated_key, "missing warning")