File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
packages/npm-packages/ruby-wasm-wasi/test/unit Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ static VALUE _rb_js_obj_to_s(VALUE obj) {
341
341
struct jsvalue * p = check_jsvalue (obj );
342
342
rb_js_abi_host_string_t ret0 ;
343
343
rb_js_abi_host_js_value_to_string (p -> abi , & ret0 );
344
- return rb_str_new (ret0 .ptr , ret0 .len );
344
+ return rb_utf8_str_new (ret0 .ptr , ret0 .len );
345
345
}
346
346
347
347
/*
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ def test_to_s
64
64
assert_equal "undefined" , JS . eval ( "return undefined;" ) . to_s
65
65
end
66
66
67
+ def test_to_s_encoding
68
+ assert_equal Encoding ::UTF_8 , JS . eval ( "return 'str';" ) . to_s . encoding
69
+ assert_equal Encoding ::UTF_8 , JS . eval ( "return 'あいうえお';" ) . to_s . encoding
70
+ end
71
+
67
72
def test_inspect
68
73
assert_equal "str" , JS . eval ( "return 'str';" ) . to_s
69
74
assert_equal "24" , JS . eval ( "return 24;" ) . inspect
You can’t perform that action at this time.
0 commit comments