mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2025-04-17 18:10:19 +00:00
Fix test262 cases
Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IBYRIV Signed-off-by: chenlong <chenlong292@h-partners.com>
This commit is contained in:
commit
f74d4d1738
@ -1568,8 +1568,8 @@ export class Array<T> implements ReadonlyArray<T>, Iterable<T> {
|
||||
const sepReal = sep === undefined ? "," : sep!
|
||||
// NOTE(aleksander-sotov) We can't call String constructor here due to internal issue 18583
|
||||
const first_el = this.$_get_unsafe(0)
|
||||
let first_str = "undefined"
|
||||
if (first_el !== undefined) {
|
||||
let first_str = ""
|
||||
if (first_el !== undefined && first_el !== null) {
|
||||
first_str = new String(first_el)
|
||||
}
|
||||
let sb = new StringBuilder(first_str)
|
||||
@ -1577,10 +1577,10 @@ export class Array<T> implements ReadonlyArray<T>, Iterable<T> {
|
||||
const tmp = this.$_get_unsafe(i)
|
||||
sb.append(sepReal);
|
||||
// NOTE(aleksander-sotov) We can't call String constructor here due to internal issue 18583
|
||||
if (tmp !== undefined) {
|
||||
if (tmp !== undefined && tmp !== null) {
|
||||
sb.append(new String(tmp))
|
||||
} else {
|
||||
sb.append("undefined")
|
||||
sb.append("")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,8 +609,8 @@
|
||||
const sepReal = sep === undefined ? "," : sep!
|
||||
<% if el_type == "T" %>// NOTE(aleksander-sotov) We can't call String constructor here due to internal issue 18583
|
||||
const first_el = <%= get_unsafe.(this, '0') %>
|
||||
let first_str = "undefined"
|
||||
if (first_el !== undefined) {
|
||||
let first_str = ""
|
||||
if (first_el !== undefined && first_el !== null) {
|
||||
first_str = new String(first_el)
|
||||
}
|
||||
let sb = new StringBuilder(first_str)<% else %>let sb = new StringBuilder(new String(<%= get_unsafe.(this, '0') %>))<% end %>
|
||||
@ -618,10 +618,10 @@
|
||||
const tmp = <%= get_unsafe.(this, 'i') %>
|
||||
sb.append(sepReal);
|
||||
<% if el_type == "T" %>// NOTE(aleksander-sotov) We can't call String constructor here due to internal issue 18583
|
||||
if (tmp !== undefined) {
|
||||
if (tmp !== undefined && tmp !== null) {
|
||||
sb.append(new String(tmp))
|
||||
} else {
|
||||
sb.append("undefined")
|
||||
sb.append("")
|
||||
}<% else %>sb.append(tmp)<% end %>
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2023-2025 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function main(): void {
|
||||
let x = new Array<number>(4);
|
||||
x[0] = 0;
|
||||
x[3] = 3;
|
||||
assertEQ(x.join(), "0,,,3", 'x.join() === "0,,,3". Actual:' + (x.join()));
|
||||
|
||||
let z = new Array<undefined>(4)
|
||||
assertEQ(z.join(), ",,,", 'z.join() === ",,,". Actual:' + (z.join()));
|
||||
|
||||
let y = new Array<null>(null,null,null);
|
||||
assertEQ(y.toString(), ",,", 'let y = new Array<null>(null,null,null); y.toString(null,null,null) === ",,". Actual:' + (y.toString()));
|
||||
}
|
||||
|
@ -12,4 +12,4 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
null undefined 11 123 std.core.Object {}
|
||||
undefined,undefined,undefined
|
||||
,,
|
||||
|
Loading…
x
Reference in New Issue
Block a user