var unicode_strings = require("unicode_strings");
function check(s1, s2) {
if (typeof version === 'undefined') {
* # Fatal error in v8::ToLocalChecked
* # Empty MaybeLocal
*/
for (let i in s1) {
if (s1[i] !== s2[i])
console.error(`Character number ${i}, ${s1.charCodeAt(i)} != ${s2.charCodeAt(i)}`);
}
}
if (s1 != s2) {
throw new Error(`'${s1}' != '${s2}'`);
}
}
test_string = "h\ufffdllo w\u00f6rld";
if (typeof print === 'undefined' || typeof version !== 'undefined') {
check(unicode_strings.non_utf8_c_str(), test_string);
check(unicode_strings.non_utf8_std_string(), test_string);
} else {
check(unicode_strings.non_utf8_c_str(), '');
check(unicode_strings.non_utf8_std_string(), '');
}