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) {
341341 struct jsvalue * p = check_jsvalue (obj );
342342 rb_js_abi_host_string_t ret0 ;
343343 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 );
345345}
346346
347347/*
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ def test_to_s
6464 assert_equal "undefined" , JS . eval ( "return undefined;" ) . to_s
6565 end
6666
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+
6772 def test_inspect
6873 assert_equal "str" , JS . eval ( "return 'str';" ) . to_s
6974 assert_equal "24" , JS . eval ( "return 24;" ) . inspect
You can’t perform that action at this time.
0 commit comments