From 216cc5d37d1b24689a5ab62933359ba55fe02616 Mon Sep 17 00:00:00 2001 From: Artem Udovichenko Date: Wed, 11 Jun 2025 14:39:00 +0300 Subject: [PATCH 1/3] Fix codecheck issues in ets files Change-Id: Ie569bc37cd469e22a16a529de3669d3fdc4337c1 Signed-off-by: Artem Udovichenko --- .../string_from_char_code_escape.ets | 20 +-- .../intrinsics/string_from_string.ets | 58 +++---- .../intrinsics/string_getbytes.ets | 28 ++-- .../intrinsics/string_hashcode.ets | 150 ++++++++--------- .../intrinsics/string_isempty.ets | 2 +- .../intrinsics/string_length.ets | 2 +- .../intrinsics/string_repeat.ets | 34 ++-- .../intrinsics/string_startswith.ets | 78 ++++----- .../intrinsics/string_substring.ets | 118 ++++++------- .../intrinsics/string_trim.ets | 156 +++++++++--------- .../ets-common-tests/intrinsics/trunc.ets | 24 +-- .../intrinsics/uint16array_sort.ets | 8 +- .../intrinsics/uint32array_sort.ets | 6 +- .../intrinsics/uint8array_sort.ets | 6 +- .../intrinsics/uint8clampedarray_sort.ets | 6 +- .../lambda/infer_type_lambda.ets | 10 +- .../ets-common-tests/overload/lambda.ets | 20 +-- .../ets-common-tests/re_export/export.ets | 2 +- .../ets-common-tests/re_export/import.ets | 5 +- .../ets-common-tests/re_export/re_export.ets | 2 +- .../re_export_with_alias/import.ets | 2 +- .../re_export_with_alias/re-export.ets | 6 +- .../recursive_import/case_0/source0.ets | 2 +- .../recursive_import/case_0/source1.ets | 6 +- .../recursive_import/case_0/source2.ets | 4 +- .../case_1_fail_not_called_w_module/foo0.ets | 4 +- .../case_1_fail_not_called_w_module/foo1.ets | 4 +- .../case_1_fail_not_called_w_module/foo2.ets | 4 +- .../case_2_3-sources-in-circle/foo0.ets | 4 +- .../case_2_3-sources-in-circle/foo1.ets | 6 +- .../case_2_3-sources-in-circle/foo2.ets | 6 +- .../case_2_3-sources-in-circle/foo3.ets | 8 +- .../foo0.ets | 2 +- .../foo1.ets | 6 +- .../foo2.ets | 6 +- .../foo3.ets | 8 +- .../foo0.ets | 2 +- .../foo1.ets | 6 +- .../foo2.ets | 6 +- .../foo3.ets | 8 +- .../foo0.ets | 2 +- .../foo1.ets | 2 +- .../foo2.ets | 4 +- .../foo3.ets | 4 +- .../recursive_import_binds_all.ets | 4 +- .../runtime_types/functions.ets | 22 +-- .../import_selective_exported.ets | 14 +- .../selective_export.ets | 14 +- .../selective_re-export/import.ets | 2 +- .../selective_re-export/re-export.ets | 2 +- .../single_export/sourceA.ets | 4 +- .../tests/ets-common-tests/stubs/equals.ets | 6 +- .../tests/ets-common-tests/stubs/istrue.ets | 18 +- .../ets-common-tests/taskpool/func_tasks.ets | 102 ++++++------ .../A/src/main/ets/a1.ets | 6 +- .../B/indexB.ets | 2 +- .../B/src/main/ets/pages/b.ets | 4 +- .../dirA/a.ets | 2 +- .../dirB/foo.ets | 2 +- .../package_names/test_01/dir/foo.ets | 2 +- .../unions/union_class_01.ets | 4 +- .../unions/union_field_access.ets | 44 ++--- .../union_field_access_with_inheritance.ets | 44 ++--- .../unions/union_getter_setter.ets | 44 ++--- .../union_getter_setter_with_inheritance.ets | 44 ++--- .../ets-common-tests/unions/union_method.ets | 20 +-- .../unions/union_method_common.ets | 4 +- .../unions/union_method_dummy_interface.ets | 14 +- .../unions/union_method_short_long_range.ets | 28 ++-- 69 files changed, 651 insertions(+), 648 deletions(-) diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_char_code_escape.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_char_code_escape.ets index 3c6fae162f..84e7aabba3 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_char_code_escape.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_char_code_escape.ets @@ -13,24 +13,24 @@ * limitations under the License. */ -function EscapeTest() { - const escapeSeqGolden = "A%20B%u1234%00%20C"; +function escapeTest() { + const escapeSeqGolden = 'A%20B%u1234%00%20C'; const escapeSeqActual = escape(String.fromCharCode(0x41, 0x20, 0x42, 0x1234, 0, 0x20, 0x43)); - assertEQ(escapeSeqActual, escapeSeqGolden, "escapeSeqActual must be equal to escapeSeqGolden"); + assertEQ(escapeSeqActual, escapeSeqGolden, 'escapeSeqActual must be equal to escapeSeqGolden'); } -function OverflowSingleCasesTest() { +function overflowSingleCasesTest() { // on arm32 this case should be disabled due to // https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IBSVYX - assertEQ(string.fromCharCode(NaN), "\u{0}", "CharCode[0] of a string built from NaN must be 0"); + assertEQ(string.fromCharCode(NaN), '\u{0}', 'CharCode[0] of a string built from NaN must be 0'); assertEQ(string.fromCharCode(NaN).length, 1); - assertEQ(string.fromCharCode(Infinity), "\u{0}", "CharCode[0] of a string built from Infinity must be 0"); + assertEQ(string.fromCharCode(Infinity), '\u{0}', 'CharCode[0] of a string built from Infinity must be 0'); assertEQ(string.fromCharCode(Infinity).length, 1); } function main(): int { - let fromCharCodeEscapeTestsuite = new ArkTestsuite("intrinsics.string_from_char_code_escape"); - fromCharCodeEscapeTestsuite.addTest("EscapeTest", EscapeTest); - fromCharCodeEscapeTestsuite.addTest("OverflowSingleCases", OverflowSingleCasesTest); + let fromCharCodeEscapeTestsuite = new ArkTestsuite('intrinsics.string_from_char_code_escape'); + fromCharCodeEscapeTestsuite.addTest('escapeTest', escapeTest); + fromCharCodeEscapeTestsuite.addTest('OverflowSingleCases', overflowSingleCasesTest); return fromCharCodeEscapeTestsuite.run(); -} \ No newline at end of file +} diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_string.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_string.ets index 4cea09fee8..c2dfc4bab6 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_string.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_from_string.ets @@ -15,7 +15,7 @@ function main(): int { - const uncompressable_strings_table: String[] = [ + const uncompressableStringsTable: String[] = [ '\u00b0', '\u00b0\u00b1', '\u00b0\u00b1\u00b2', @@ -35,39 +35,39 @@ function main(): int { ]; - let compressable_strings_table: String[] = [ - "0", - "01", - "012", - "0123", - "01234", - "012345", - "0123456", - "01234567", - "012345678", - "0123456789", - "0123456789a", - "0123456789ab", - "0123456789abc", - "0123456789abcd", - "0123456789abcde", - "0123456789abcdef", - "0123456789abcdefg", - "0123456789abcdefgh", - "0123456789abcdefghi", - "0123456789abcdefghij", - "0123456789abcdefghijk" + let compressableStringsTable: String[] = [ + '0', + '01', + '012', + '0123', + '01234', + '012345', + '0123456', + '01234567', + '012345678', + '0123456789', + '0123456789a', + '0123456789ab', + '0123456789abc', + '0123456789abcd', + '0123456789abcde', + '0123456789abcdef', + '0123456789abcdefg', + '0123456789abcdefgh', + '0123456789abcdefghi', + '0123456789abcdefghij', + '0123456789abcdefghijk' ]; - for (let i: int = 0; i < compressable_strings_table.length; i++) { - let tmp = new String(compressable_strings_table[i]); - if (tmp != compressable_strings_table[i]) { + for (let i: int = 0; i < compressableStringsTable.length; i++) { + let tmp = new String(compressableStringsTable[i]); + if (tmp != compressableStringsTable[i]) { return 1; } } - for (let i: int = 0; i < uncompressable_strings_table.length; i++) { - let tmp = new String(uncompressable_strings_table[i]); - if (tmp != uncompressable_strings_table[i]) { + for (let i: int = 0; i < uncompressableStringsTable.length; i++) { + let tmp = new String(uncompressableStringsTable[i]); + if (tmp != uncompressableStringsTable[i]) { return 2; } } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_getbytes.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_getbytes.ets index 5b5e6eaebe..6e121680d8 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_getbytes.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_getbytes.ets @@ -13,28 +13,28 @@ * limitations under the License. */ -let str: String = new String("abcΣΨΩ0123456789!"); +let str: String = new String('abcΣΨΩ0123456789!'); let bytes: byte[] = [97, 98, 99, -93, -88, -87, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 33] -function equals(val: byte[], exp: byte[], offset: int): boolean -{ - if (val.length != (exp.length - offset)) +function equals(val: byte[], exp: byte[], offset: int): boolean { + if (val.length != (exp.length - offset)) { return false; + } for (let i: int = 0; i < val.length; ++i) { - if (val[i] != exp[i + offset]) + if (val[i] != exp[i + offset]) { return false; + } } return true; } -function printArray(a: byte[], offset: int, name: String): void -{ - console.println(name + " length: " + (a.length - offset)) - console.print(name + " data: [ ") +function printArray(a: byte[], offset: int, name: String): void { + console.println(name + ' length: ' + (a.length - offset)) + console.print(name + ' data: [ ') for (let i: int = 0; i < a.length; ++i) { - console.print(a[i + offset] + " "); + console.print(a[i + offset] + ' '); } - console.println("]"); + console.println(']'); } function main(): int { @@ -42,9 +42,9 @@ function main(): int { for (let i: int = 0; i < len; ++i) { let arr: byte[] = str.getBytes(i, len); if (!equals(arr, bytes, i)) { - console.println("at: " + i); - printArray(arr, 0, "actual ") - printArray(bytes, i, "expected") + console.println('at: ' + i); + printArray(arr, 0, 'actual ') + printArray(bytes, i, 'expected') return 1; } } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets index 7cf4d2bf79..212c86e81d 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets @@ -13,49 +13,49 @@ * limitations under the License. */ -let compressable_strings_table: FixedArray = [ - "\0", - "0", - "01", - "012", - "0123", - "01234", - "012345", - "0123456", - "01234567", - "012345678", - "0123456789", - "0123456789a", - "0123456789ab", - "0123456789abc", - "0123456789abcd", - "0123456789abcde", - "0123456789abcdef", - "0123456789abcdefg", - "0123456789abcdefgh", - "0123456789abcdefghi", - "0123456789abcdefghij", - "0123456789abcdefghijk" +let compressableStringsTable: FixedArray = [ + '\0', + '0', + '01', + '012', + '0123', + '01234', + '012345', + '0123456', + '01234567', + '012345678', + '0123456789', + '0123456789a', + '0123456789ab', + '0123456789abc', + '0123456789abcd', + '0123456789abcde', + '0123456789abcdef', + '0123456789abcdefg', + '0123456789abcdefgh', + '0123456789abcdefghi', + '0123456789abcdefghij', + '0123456789abcdefghijk' ]; -let uncompressable_strings_table: FixedArray = [ - "\u0000", - "\u00b0", - "\u00b0\u00b1", - "\u00b0\u00b1\u00b2", - "\u00b0\u00b1\u00b2\u00b3", - "\u00b0\u00b1\u00b2\u00b3\u00b4", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be", - "\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf" +let uncompressableStringsTable: FixedArray = [ + '\u0000', + '\u00b0', + '\u00b0\u00b1', + '\u00b0\u00b1\u00b2', + '\u00b0\u00b1\u00b2\u00b3', + '\u00b0\u00b1\u00b2\u00b3\u00b4', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be', + '\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf' ]; let compressable_hashcode_table: FixedArray = [ @@ -103,60 +103,60 @@ let uncompressable_hashcode_table: FixedArray = [ -1966137336 ]; -let hash_collision_a: FixedArray = [ 1, 0 ]; -let hash_collision_b: FixedArray = [ 0, 31 ]; -let hash_collision_c: FixedArray = [ 2, 0 ]; -let hash_collision_d: FixedArray = [ 1, 31 ]; +let hashCollisionA: FixedArray = [1, 0]; +let hashCollisionB: FixedArray = [0, 31]; +let hashCollisionC: FixedArray = [2, 0]; +let hashCollisionD: FixedArray = [1, 31]; function main(): int { - for (let i: int = 0; i < compressable_strings_table.length; i++) { - let hashcode: int = compressable_strings_table[i].$_hashCode(); + for (let i: int = 0; i < compressableStringsTable.length; i++) { + let hashcode: int = compressableStringsTable[i].$_hashCode(); if (hashcode != compressable_hashcode_table[i]) { - console.println("Expected hashcode: " + compressable_hashcode_table[i] + - ", computed hashcode: " + hashcode + - " (compressable, i = " + i + ")"); - console.println("FAIL"); + console.println('Expected hashcode: ' + compressable_hashcode_table[i] + + ', computed hashcode: ' + hashcode + + ' (compressable, i = ' + i + ')'); + console.println('FAIL'); return 1; } } - for (let i: int = 0; i < uncompressable_strings_table.length; i++) { - let hashcode: int = uncompressable_strings_table[i].$_hashCode(); + for (let i: int = 0; i < uncompressableStringsTable.length; i++) { + let hashcode: int = uncompressableStringsTable[i].$_hashCode(); if (hashcode != uncompressable_hashcode_table[i]) { - console.println("Expected hashcode: " + uncompressable_hashcode_table[i] + - ", computed hashcode: " + hashcode + - " (uncompressable, i = " + i + ")"); - console.println("FAIL"); + console.println('Expected hashcode: ' + uncompressable_hashcode_table[i] + + ', computed hashcode: ' + hashcode + + ' (uncompressable, i = ' + i + ')'); + console.println('FAIL'); return 2; } } // Test hash collisions - let hc_a: String = new String(hash_collision_a); - let hc_b: String = new String(hash_collision_b); - if (hc_a.$_hashCode() != 31) { - console.println("hc_a hashcode: " + hc_a.$_hashCode()); - console.println("FAIL"); + let hcA: String = new String(hashCollisionA); + let hcB: String = new String(hashCollisionB); + if (hcA.$_hashCode() != 31) { + console.println('hcA hashcode: ' + hc_a.$_hashCode()); + console.println('FAIL'); return 3; } - if (hc_a.$_hashCode() != hc_b.$_hashCode()) { - console.println("hc_a hashcode: " + hc_a.$_hashCode()); - console.println("hc_b hashcode: " + hc_b.$_hashCode()); - console.println("FAIL"); + if (hcA.$_hashCode() != hcB.$_hashCode()) { + console.println('hcA hashcode: ' + hc_a.$_hashCode()); + console.println('hcB hashcode: ' + hcB.$_hashCode()); + console.println('FAIL'); return 4; } - let hc_c: String = new String(hash_collision_c); - let hc_d: String = new String(hash_collision_d); - if (hc_c.$_hashCode() != 62) { - console.println("hc_c hashcode: " + hc_c.$_hashCode()); - console.println("FAIL"); + let hcC: String = new String(hashCollisionC); + let hcD: String = new String(hashCollisionD); + if (hcC.$_hashCode() != 62) { + console.println('hcC hashcode: ' + hcC.$_hashCode()); + console.println('FAIL'); return 5; } - if (hc_c.$_hashCode() != hc_d.$_hashCode()) { - console.println("hc_c hashcode: " + hc_c.$_hashCode()); - console.println("hc_d hashcode: " + hc_d.$_hashCode()); - console.println("FAIL"); + if (hcC.$_hashCode() != hcD.$_hashCode()) { + console.println('hcC hashcode: ' + hcC.$_hashCode()); + console.println('hcD hashcode: ' + hcD.$_hashCode()); + console.println('FAIL'); return 6; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_isempty.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_isempty.ets index 41bb35891b..30252a4122 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_isempty.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_isempty.ets @@ -14,7 +14,7 @@ */ function newString(): String { - return new String("abcde"); + return new String('abcde'); } function main(): int { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_length.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_length.ets index cb3052ec3a..42e4735ee0 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_length.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_length.ets @@ -14,7 +14,7 @@ */ function newString(): String { - return new String("abcde"); + return new String('abcde'); } function main(): int { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_repeat.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_repeat.ets index ad76b9f301..dfb253e340 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_repeat.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_repeat.ets @@ -13,32 +13,32 @@ * limitations under the License. */ -const Empty: String = ''; -const Hello: String = 'Hello'; -const HelloDup: String = 'HelloHelloHelloHelloHelloHelloHelloHello'; -const Nature: String = '自然界'; -const NatureDup: String = '自然界自然界自然界自然界自然界自然界自然界自然界'; +const gEmpty: String = ''; +const gHello: String = 'gHello'; +const gHelloDup: String = 'HelloHelloHelloHelloHelloHelloHelloHello'; +const gNature: String = '自然界'; +const gNatureDup: String = '自然界自然界自然界自然界自然界自然界自然界自然界'; function main(): int { - assertEQ(Empty.repeat(0), "") - assertEQ(Empty.repeat(1), "") - assertEQ(Nature.repeat(0), "") - assertEQ(Hello.repeat(0), "") - for(let i: int = 1; i < 8; ++i) { - let hello: String = Hello.repeat(i); - let nature: String = Nature.repeat(i); - if(hello != HelloDup.substring(0, 5 * i)) { - return 10+i; + assertEQ(gEmpty.repeat(0), '') + assertEQ(gEmpty.repeat(1), '') + assertEQ(gNature.repeat(0), '') + assertEQ(gHello.repeat(0), '') + for (let i: int = 1; i < 8; ++i) { + let hello: String = gHello.repeat(i); + let nature: String = gNature.repeat(i); + if (hello != gHelloDup.substring(0, 5 * i)) { + return 10 + i; } - if (nature != NatureDup.substring(0, 3 * i)) { - return 20+i; + if (nature != gNatureDup.substring(0, 3 * i)) { + return 20 + i; } } // try repeat() with a negative index let errors: int = 0; try { - let z = Empty.repeat(-1); + let z = gEmpty.repeat(-1); } catch (e) { errors = 1; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_startswith.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_startswith.ets index 87306e882f..278b710539 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_startswith.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_startswith.ets @@ -13,52 +13,52 @@ * limitations under the License. */ -const Empty: String = ''; -const Esc: String = '\t\n\v'; -const Hello: String = 'Hello'; -const Nature: String = '自然界'; +const gEmpty: String = ''; +const gEsc: String = '\t\n\v'; +const gHello: String = 'gHello'; +const gNature: String = '自然界'; function main(): int { - assertTrue(Empty.startsWith('')); - assertTrue(Empty.startsWith('', -1)); - assertTrue(Empty.startsWith('', 0)); - assertTrue(Empty.startsWith('', 1)); - assertFalse(Empty.startsWith('*')) - assertFalse(Empty.startsWith('*', -1)) - assertFalse(Empty.startsWith('*', 0)) - assertFalse(Empty.startsWith('*', 1)) + assertTrue(gEmpty.startsWith('')); + assertTrue(gEmpty.startsWith('', -1)); + assertTrue(gEmpty.startsWith('', 0)); + assertTrue(gEmpty.startsWith('', 1)); + assertFalse(gEmpty.startsWith('*')) + assertFalse(gEmpty.startsWith('*', -1)) + assertFalse(gEmpty.startsWith('*', 0)) + assertFalse(gEmpty.startsWith('*', 1)) - assertTrue(Esc.startsWith('\t')) - assertTrue(Esc.startsWith('\t', -1)) - assertTrue(Esc.startsWith('\t', 0)) - assertTrue(Esc.startsWith('\n', 1)) - assertTrue(Esc.startsWith('\v', 2)) + assertTrue(gEsc.startsWith('\t')) + assertTrue(gEsc.startsWith('\t', -1)) + assertTrue(gEsc.startsWith('\t', 0)) + assertTrue(gEsc.startsWith('\n', 1)) + assertTrue(gEsc.startsWith('\v', 2)) - assertTrue(Hello.startsWith('')) - assertTrue(Hello.startsWith('',-1)) - assertTrue(Hello.startsWith('', 0)) - assertTrue(Hello.startsWith('', 1)) - assertTrue(Hello.startsWith('', 2)) - assertTrue(Hello.startsWith('', 3)) - assertTrue(Hello.startsWith('', 4)) - assertTrue(Hello.startsWith('', 5)) + assertTrue(gHello.startsWith('')) + assertTrue(gHello.startsWith('', -1)) + assertTrue(gHello.startsWith('', 0)) + assertTrue(gHello.startsWith('', 1)) + assertTrue(gHello.startsWith('', 2)) + assertTrue(gHello.startsWith('', 3)) + assertTrue(gHello.startsWith('', 4)) + assertTrue(gHello.startsWith('', 5)) - assertTrue(Hello.startsWith('H')) - assertTrue(Hello.startsWith("Hel")) - assertTrue(Hello.startsWith("Hel", 0)) - assertTrue(Hello.startsWith("Hel", -1)) - assertTrue(Hello.startsWith("ello", 1)) - assertTrue(Hello.startsWith("o", 4)) + assertTrue(gHello.startsWith('H')) + assertTrue(gHello.startsWith('Hel')) + assertTrue(gHello.startsWith('Hel', 0)) + assertTrue(gHello.startsWith('Hel', -1)) + assertTrue(gHello.startsWith('ello', 1)) + assertTrue(gHello.startsWith('o', 4)) - assertTrue(Nature.startsWith('自然界')) - assertTrue(Nature.startsWith('自然')) - assertTrue(Nature.startsWith("自")) - assertTrue(Nature.startsWith("自", -1)) - assertFalse(Nature.startsWith("然", 0)) - assertTrue(Nature.startsWith("然界", 1)) - assertTrue(Nature.startsWith("界", 2)) - assertFalse(Nature.startsWith("界", 3)) + assertTrue(gNature.startsWith('自然界')) + assertTrue(gNature.startsWith('自然')) + assertTrue(gNature.startsWith('自')) + assertTrue(gNature.startsWith('自', -1)) + assertFalse(gNature.startsWith('然', 0)) + assertTrue(gNature.startsWith('然界', 1)) + assertTrue(gNature.startsWith('界', 2)) + assertFalse(gNature.startsWith('界', 3)) return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_substring.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_substring.ets index 36c2e69ed7..e811a377c9 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_substring.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_substring.ets @@ -15,50 +15,50 @@ const DUMP: boolean = false; const HITS_EXPECTED: int = 40; -let golden: String = new String("abc\u03a3\u03a8\u03a90123456789!"); -let str_len_plus_1: int = golden.getLength() + 1; +let golden: String = new String('abc\u03a3\u03a8\u03a90123456789!'); +let strlenPlus1: int = golden.getLength() + 1; let hits: int = 0; -let string_table1: String[] = [ - "abcΣΨΩ0123456789!", - "bcΣΨΩ0123456789!", - "cΣΨΩ0123456789!", - "ΣΨΩ0123456789!", - "ΨΩ0123456789!", - "Ω0123456789!", - "0123456789!", - "123456789!", - "23456789!", - "3456789!", - "456789!", - "56789!", - "6789!", - "789!", - "89!", - "9!", - "!", - "" +let stringTable1: String[] = [ + 'abcΣΨΩ0123456789!', + 'bcΣΨΩ0123456789!', + 'cΣΨΩ0123456789!', + 'ΣΨΩ0123456789!', + 'ΨΩ0123456789!', + 'Ω0123456789!', + '0123456789!', + '123456789!', + '23456789!', + '3456789!', + '456789!', + '56789!', + '6789!', + '789!', + '89!', + '9!', + '!', + '' ]; -let string_table2: String[] = [ - "", - "a", - "ab", - "abc", - "abcΣ", - "abcΣΨ", - "abcΣΨΩ", - "abcΣΨΩ0", - "abcΣΨΩ01", - "abcΣΨΩ012", - "abcΣΨΩ0123", - "abcΣΨΩ01234", - "abcΣΨΩ012345", - "abcΣΨΩ0123456", - "abcΣΨΩ01234567", - "abcΣΨΩ012345678", - "abcΣΨΩ0123456789", - "abcΣΨΩ0123456789!" +let stringTable2: String[] = [ + '', + 'a', + 'ab', + 'abc', + 'abcΣ', + 'abcΣΨ', + 'abcΣΨΩ', + 'abcΣΨΩ0', + 'abcΣΨΩ01', + 'abcΣΨΩ012', + 'abcΣΨΩ0123', + 'abcΣΨΩ01234', + 'abcΣΨΩ012345', + 'abcΣΨΩ0123456', + 'abcΣΨΩ01234567', + 'abcΣΨΩ012345678', + 'abcΣΨΩ0123456789', + 'abcΣΨΩ0123456789!' ]; @@ -66,53 +66,57 @@ function main(): int { for (let i: int = 0; i <= golden.getLength(); ++i) { let subs: String = golden.substring(i, golden.getLength()); - assertLT(i, string_table1.length); - if (subs == string_table1[i]) { + assertLT(i, stringTable1.length); + if (subs == stringTable1[i]) { ++hits; } - if (DUMP) console.println(subs); + if (DUMP) { + console.println(subs); + } } for (let i: int = 0; i <= golden.getLength(); ++i) { - assertLT(i, string_table2.length); + assertLT(i, stringTable2.length); let subs: String = golden.substring(0, i); - if (subs == string_table2[i]) { + if (subs == stringTable2[i]) { ++hits; } - if (DUMP) console.println(subs); + if (DUMP) { + console.println(subs); + } } - assertLT(golden.getLength(), str_len_plus_1); + assertLT(golden.getLength(), strlenPlus1); // If begin_index < 0, then it is assumed to be equal to zero. - if (golden.substring(-1, 1) == "a") { + if (golden.substring(-1, 1) == 'a') { ++hits; } else if (DUMP) { - console.println("substring failed if begin_index < 0"); + console.println('substring failed if begin_index < 0'); } // If begin_index > str_len, then it is assumed to be equal to str_len. // If begin_index > end_index, then these are swapped. - if (golden.substring(str_len_plus_1, 1) == "bcΣΨΩ0123456789!") { + if (golden.substring(strlenPlus1, 1) == 'bcΣΨΩ0123456789!') { ++hits; } else if (DUMP) { - console.println("substring failed if (begin_index > str_len || begin_index > end_index"); + console.println('substring failed if (begin_index > str_len || begin_index > end_index'); } // If end_index < 0, then it is assumed to be equal to zero. - if (golden.substring(0, -1) == "") { + if (golden.substring(0, -1) == '') { ++hits; } else if (DUMP) { - console.println("substring failed if end_index < 0"); + console.println('substring failed if end_index < 0'); } // If end_index > str_len, then it is assumed to be equal to str_len. - if (golden.substring(0, str_len_plus_1) == golden) { + if (golden.substring(0, strlenPlus1) == golden) { ++hits; } else if (DUMP) { - console.println("substring failed if end_index > str_len"); + console.println('substring failed if end_index > str_len'); } if (hits != HITS_EXPECTED) { if (DUMP) { - console.println("hits: " + hits + " (expected " + HITS_EXPECTED + ")"); + console.println('hits: ' + hits + ' (expected ' + HITS_EXPECTED + ')'); } - console.println("FAIL"); + console.println('FAIL'); return 1; } return 0; diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_trim.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_trim.ets index b1c6a689c3..b61332a476 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_trim.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_trim.ets @@ -40,36 +40,36 @@ 0xFEFF -- byte order mark 0x3000 -- ideographic space */ -const Wss: String = +const gWss: String = '\u0020\u0009\u000A\u000B\u000C\u000D\u00A0\u1680\ \u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\ \u2008\u2009\u200A\u2028\u2029\u202F\u205F\uFEFF\u3000'; -const Empty: String = ''; -const Ws: String = ' '; -const X: String = 'x'; -const XWs: String = X + Ws; -const WsX: String = Ws + X; -const WsXWs: String = Ws + X + Ws; -const Xy: String = 'Xy'; -const WsXy: String = Ws + 'Xy'; -const XyWs: String = 'Xy' + Ws; -const WsXyWs: String = Ws + 'Xy' + Ws; -const Z: String = '\u01B5'; // 'Ƶ' -const ZWs: String = Z + Ws; -const WsZ: String = Ws + Z; -const WsZWs: String = Ws + Z + Ws; -const Abc: String = 'abc'; -const AwsBwsC: String = 'a b c'; -const WsAbc: String = ' ' + Abc; -const AbcWs: String = Abc + ' '; -const WsAbcWs: String = ' ' + Abc + ' '; -const WssAbc: String = Wss + Abc; -const AbcWss: String = Abc + Wss; -const WssAbcWss: String = Wss + Abc + Wss; -const AbcWssAbc: String = Abc + Wss + Abc; -const Esc: String = ' \t\n\v'; -const RusChars: String = 'Русские буквы'; +const gEmpty: String = ''; +const gWs: String = ' '; +const gX: String = 'x'; +const gXWs: String = gX + gWs; +const gWsX: String = gWs + gX; +const gWsXWs: String = gWs + gX + gWs; +const gXy: String = 'gXy'; +const gWsXy: String = gWs + 'gXy'; +const gXyWs: String = 'gXy' + gWs; +const gWsXyWs: String = gWs + 'gXy' + gWs; +const gZ: String = '\u01B5'; // 'Ƶ' +const gZWs: String = gZ + gWs; +const gWsZ: String = gWs + gZ; +const gWsZWs: String = gWs + gZ + gWs; +const gAbc: String = 'abc'; +const gAwsBwsC: String = 'a b c'; +const gWsAbc: String = ' ' + gAbc; +const gAbcWs: String = gAbc + ' '; +const gWsAbcWs: String = ' ' + gAbc + ' '; +const gWssAbc: String = gWss + gAbc; +const gAbcWss: String = gAbc + gWss; +const gWssAbcWss: String = gWss + gAbc + gWss; +const gAbcWssAbc: String = gAbc + gWss + gAbc; +const gEsc: String = ' \t\n\v'; +const gRusChars: String = 'Русские буквы'; function main(): int { @@ -78,64 +78,64 @@ function main(): int { let c = i.toChar(); if (Char.isWhiteSpace(c)) { ++wssCount; - assertNE(Wss.indexOf(c), -1, 'Bad char code is encountered: ' + i); + assertNE(gWss.indexOf(c), -1, 'Bad char code is encountered: ' + i); } } - assertEQ(wssCount, Wss.length, 'Wrong number of u16 whitespaces: ' + wssCount); + assertEQ(wssCount, gWss.length, 'Wrong number of u16 whitespaces: ' + wssCount); // trim - assertEQ(Empty.trim(), "") - assertEQ(Ws.trim(), Empty) - assertEQ(Wss.trim(), Empty) - assertEQ(Xy.trim(), Xy) - assertEQ(WsXy.trim(), Xy) - assertEQ(XyWs.trim(), Xy) - assertEQ(WsXyWs.trim(), Xy) - assertEQ(Abc.trim(), Abc) - assertEQ(WsAbc.trim(), Abc) - assertEQ(AbcWs.trim(), Abc) - assertEQ(WsAbcWs.trim(), Abc) - assertEQ(AwsBwsC.trim(), AwsBwsC) - assertEQ(WssAbc.trim(), Abc) - assertEQ(AbcWss.trim(), Abc) - assertEQ(WssAbcWss.trim(), Abc) - assertEQ(AbcWssAbc.trim(), AbcWssAbc) - assertEQ(X.trim(), X) - assertEQ(WsX.trim(), X) - assertEQ(XWs.trim(), X) - assertEQ(Z.trim(), Z) - assertEQ(WsZ.trim(), Z) - assertEQ(ZWs.trim(), Z) - assertEQ(Esc.trim(), Empty) - assertEQ(RusChars.trim(), RusChars) + assertEQ(gEmpty.trim(), '') + assertEQ(gWs.trim(), gEmpty) + assertEQ(gWss.trim(), gEmpty) + assertEQ(gXy.trim(), gXy) + assertEQ(gWsXy.trim(), gXy) + assertEQ(gXyWs.trim(), gXy) + assertEQ(gWsXyWs.trim(), gXy) + assertEQ(gAbc.trim(), gAbc) + assertEQ(gWsAbc.trim(), gAbc) + assertEQ(gAbcWs.trim(), gAbc) + assertEQ(gWsAbcWs.trim(), gAbc) + assertEQ(gAwsBwsC.trim(), gAwsBwsC) + assertEQ(gWssAbc.trim(), gAbc) + assertEQ(gAbcWss.trim(), gAbc) + assertEQ(gWssAbcWss.trim(), gAbc) + assertEQ(gAbcWssAbc.trim(), gAbcWssAbc) + assertEQ(gX.trim(), gX) + assertEQ(gWsX.trim(), gX) + assertEQ(gXWs.trim(), gX) + assertEQ(gZ.trim(), gZ) + assertEQ(gWsZ.trim(), gZ) + assertEQ(gZWs.trim(), gZ) + assertEQ(gEsc.trim(), gEmpty) + assertEQ(gRusChars.trim(), gRusChars) // trimLeft - assertEQ(Ws.trimLeft(), Empty) - assertEQ(Wss.trimLeft(), Empty) - assertEQ(WsAbcWs.trimLeft(), AbcWs) - assertEQ(AwsBwsC.trimLeft(), AwsBwsC) - assertEQ(WssAbcWss.trimLeft(), AbcWss) - assertEQ(X.trimLeft(), X) - assertEQ(WsX.trimLeft(), X) - assertEQ(XWs.trimLeft(), XWs) - assertEQ(Z.trimLeft(), Z) - assertEQ(WsZ.trimLeft(), Z) - assertEQ(ZWs.trimLeft(), ZWs) - assertEQ(Esc.trimLeft(), Empty) - assertEQ(RusChars.trimLeft(), RusChars) + assertEQ(gWs.trimLeft(), gEmpty) + assertEQ(gWss.trimLeft(), gEmpty) + assertEQ(gWsAbcWs.trimLeft(), gAbcWs) + assertEQ(gAwsBwsC.trimLeft(), gAwsBwsC) + assertEQ(gWssAbcWss.trimLeft(), gAbcWss) + assertEQ(gX.trimLeft(), gX) + assertEQ(gWsX.trimLeft(), gX) + assertEQ(gXWs.trimLeft(), gXWs) + assertEQ(gZ.trimLeft(), gZ) + assertEQ(gWsZ.trimLeft(), gZ) + assertEQ(gZWs.trimLeft(), gZWs) + assertEQ(gEsc.trimLeft(), gEmpty) + assertEQ(gRusChars.trimLeft(), gRusChars) // trimRight - assertEQ(Ws.trimRight(), Empty) - assertEQ(Wss.trimRight(), Empty) - assertEQ(WsAbcWs.trimRight(), WsAbc) - assertEQ(AwsBwsC.trimRight(), AwsBwsC) - assertEQ(WssAbcWss.trimRight(), WssAbc) - assertEQ(X.trimRight(), X) - assertEQ(WsX.trimRight(), WsX) - assertEQ(XWs.trimRight(), X) - assertEQ(Z.trimRight(), Z) - assertEQ(WsZ.trimRight(), WsZ) - assertEQ(ZWs.trimRight(), Z) - assertEQ(Esc.trimRight(), Empty) - assertEQ(RusChars.trimRight(), RusChars) + assertEQ(gWs.trimRight(), gEmpty) + assertEQ(gWss.trimRight(), gEmpty) + assertEQ(gWsAbcWs.trimRight(), gWsAbc) + assertEQ(gAwsBwsC.trimRight(), gAwsBwsC) + assertEQ(gWssAbcWss.trimRight(), gWssAbc) + assertEQ(gX.trimRight(), gX) + assertEQ(gWsX.trimRight(), gWsX) + assertEQ(gXWs.trimRight(), gX) + assertEQ(gZ.trimRight(), gZ) + assertEQ(gWsZ.trimRight(), gWsZ) + assertEQ(gZWs.trimRight(), gZ) + assertEQ(gEsc.trimRight(), gEmpty) + assertEQ(gRusChars.trimRight(), gRusChars) return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/trunc.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/trunc.ets index e9861a5695..c9df4a4120 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/trunc.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/trunc.ets @@ -14,18 +14,18 @@ */ function main(): int { - if (trunc(Double.POSITIVE_INFINITY) != Double.POSITIVE_INFINITY) return 1; - if (trunc(Double.NEGATIVE_INFINITY) != Double.NEGATIVE_INFINITY) return 2; - if (Double.toString(trunc(Double.NaN)) != Double.toString(Double.NaN)) return 3; - if (trunc(0.) != 0.) return 4; - if (trunc(1.) != 1.) return 5; - if (trunc(-1.) != -1.) return 6; - if (trunc(1.5) != 1.) return 7; - if (trunc(1.6) != 1.) return 8; - if (trunc(1.4) != 1.) return 9; - if (trunc(-1.5) != -1.) return 10; - if (trunc(-1.6) != -1.) return 11; - if (trunc(-1.4) != -1.) return 12; + if (trunc(Double.POSITIVE_INFINITY) != Double.POSITIVE_INFINITY) { return 1; } + if (trunc(Double.NEGATIVE_INFINITY) != Double.NEGATIVE_INFINITY) { return 2; } + if (Double.toString(trunc(Double.NaN)) != Double.toString(Double.NaN)) { return 3; } + if (trunc(0.) != 0.) { return 4; } + if (trunc(1.) != 1.) { return 5; } + if (trunc(-1.) != -1.) { return 6; } + if (trunc(1.5) != 1.) { return 7; } + if (trunc(1.6) != 1.) { return 8; } + if (trunc(1.4) != 1.) { return 9; } + if (trunc(-1.5) != -1.) { return 10; } + if (trunc(-1.6) != -1.) { return 11; } + if (trunc(-1.4) != -1.) { return 12; } return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint16array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint16array_sort.ets index 2339333a51..b283632184 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint16array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint16array_sort.ets @@ -15,9 +15,9 @@ const ARRAY_SIZE = 15; const AB_SIZE = ARRAY_SIZE * Short.BYTE_SIZE; -const UNSORTED: Array = [5,3,127,2,4,255,99,10,7,65535 as int,45,1,88,6,0]; -const SORTED = [0,1,2,3,4,5,6,7,10,45,88,99,127,255,65535 as int]; -const SORTED_UNALIGNED = [0,1,2,3,4,6,7,10,45,88,99,127,255,65535 as int]; +const UNSORTED: Array = [5, 3, 127, 2, 4, 255, 99, 10, 7, 65535 as int, 45, 1, 88, 6, 0]; +const SORTED = [0, 1, 2, 3, 4, 5, 6, 7, 10, 45, 88, 99, 127, 255, 65535 as int]; +const SORTED_UNALIGNED = [0, 1, 2, 3, 4, 6, 7, 10, 45, 88, 99, 127, 255, 65535 as int]; const SINGLE = [88]; function fillBuffer(buf: ArrayBuffer): void { @@ -25,7 +25,7 @@ function fillBuffer(buf: ArrayBuffer): void { assertEQ(Short.BYTE_SIZE, 2); for (let i = 0; i < AB_SIZE; ++i) { if ((i % Short.BYTE_SIZE) == 0) { - let v: int = UNSORTED[i/2].toInt(); + let v: int = UNSORTED[i / 2].toInt(); if (Runtime.isLittleEndianPlatform()) { buf.set(i, v.toByte()); buf.set(i + 1, (v >>> 8).toByte()); diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint32array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint32array_sort.ets index 32d5fc5587..14786a3299 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint32array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint32array_sort.ets @@ -15,9 +15,9 @@ const ARRAY_SIZE = 15; const AB_SIZE = ARRAY_SIZE * Int.BYTE_SIZE; -const UNSORTED: Array = [5,3,127,2,4,255,99,10,7,0,45,1,88,6,4294967295 as long]; -const SORTED = [0,1,2,3,4,5,6,7,10,45,88,99,127,255,4294967295 as long]; -const SORTED_UNALIGNED = [0,1,2,3,4,6,7,10,45,88,99,127,255,4294967295 as long]; +const UNSORTED: Array = [5, 3, 127, 2, 4, 255, 99, 10, 7, 0, 45, 1, 88, 6, 4294967295 as long]; +const SORTED = [0, 1, 2, 3, 4, 5, 6, 7, 10, 45, 88, 99, 127, 255, 4294967295 as long]; +const SORTED_UNALIGNED = [0, 1, 2, 3, 4, 6, 7, 10, 45, 88, 99, 127, 255, 4294967295 as long]; const SINGLE = [88]; function fillBuffer(buf: ArrayBuffer): void { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8array_sort.ets index 64b79f3288..5e07070a8f 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8array_sort.ets @@ -14,9 +14,9 @@ */ const ARRAY_SIZE = 15; -const UNSORTED: Array = [5,3,127,2,4,255 as short,99,10,7,0,45,1,88,6,37]; -const SORTED = [0,1,2,3,4,5,6,7,10,37,45,88,99,127,255 as short]; -const SORTED_UNALIGNED = [0,1,2,3,4,6,7,10,37,45,88,99,127,255 as short]; +const UNSORTED: Array = [5, 3, 127, 2, 4, 255 as short, 99, 10, 7, 0, 45, 1, 88, 6, 37]; +const SORTED = [0, 1, 2, 3, 4, 5, 6, 7, 10, 37, 45, 88, 99, 127, 255 as short]; +const SORTED_UNALIGNED = [0, 1, 2, 3, 4, 6, 7, 10, 37, 45, 88, 99, 127, 255 as short]; const SINGLE = [88]; function fillBuffer(buf: ArrayBuffer): void { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8clampedarray_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8clampedarray_sort.ets index dca53db74a..65de2b3d11 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8clampedarray_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/uint8clampedarray_sort.ets @@ -14,9 +14,9 @@ */ const ARRAY_SIZE = 15; -const UNSORTED: Array = [5,3,127,2,4,255 as short,99,10,7,0,45,1,88,6,37]; -const SORTED = [0,1,2,3,4,5,6,7,10,37,45,88,99,127,255 as short]; -const SORTED_UNALIGNED = [0,1,2,3,4,6,7,10,37,45,88,99,127,255 as short]; +const UNSORTED: Array = [5, 3, 127, 2, 4, 255 as short, 99, 10, 7, 0, 45, 1, 88, 6, 37]; +const SORTED = [0, 1, 2, 3, 4, 5, 6, 7, 10, 37, 45, 88, 99, 127, 255 as short]; +const SORTED_UNALIGNED = [0, 1, 2, 3, 4, 6, 7, 10, 37, 45, 88, 99, 127, 255 as short]; const SINGLE = [88]; function fillBuffer(buf: ArrayBuffer): void { diff --git a/static_core/plugins/ets/tests/ets-common-tests/lambda/infer_type_lambda.ets b/static_core/plugins/ets/tests/ets-common-tests/lambda/infer_type_lambda.ets index 71d5cfb104..f6b3ce7ebe 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/lambda/infer_type_lambda.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/lambda/infer_type_lambda.ets @@ -14,7 +14,7 @@ */ class Foo { - public lambdaInferType () { + public lambdaInferType() { let x = () => { return 1 } @@ -22,14 +22,14 @@ class Foo { } public lambdaInferTypeReturnLambda() { - let x= () => () => { + let x = () => () => { return 1 } return x } public lambdaInferTypeReturnLambda1() { - let x= ()=>{ + let x = () => { let y = () => { return 1 } @@ -38,12 +38,12 @@ class Foo { return x } - public lambdaInferTypeReturnLiteral () { + public lambdaInferTypeReturnLiteral() { let x = () => 1 return x } - public lambdaNestingReturnStatement () { + public lambdaNestingReturnStatement() { return () => { return () => { return 1 diff --git a/static_core/plugins/ets/tests/ets-common-tests/overload/lambda.ets b/static_core/plugins/ets/tests/ets-common-tests/overload/lambda.ets index 159a8d9d0c..a0ade3e4d4 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/overload/lambda.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/overload/lambda.ets @@ -13,32 +13,32 @@ * limitations under the License. */ -let void_called: boolean = false; -let int_called = false; +let voidCalled: boolean = false; +let intCalled = false; function reset(): void { - void_called = false; - int_called = false; + voidCalled = false; + intCalled = false; } function foo(callback: () => void): void { - void_called = true; + voidCalled = true; } function foo(callback: (x: int) => void): void { - int_called = true; + intCalled = true; } function main(): void { reset(); foo((): void => { }); - assertTrue(void_called); - assertFalse(int_called); + assertTrue(voidCalled); + assertFalse(intCalled); reset(); foo((x: int): void => { }); - assertFalse(void_called); - assertTrue(int_called); + assertFalse(voidCalled); + assertTrue(intCalled); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/re_export/export.ets b/static_core/plugins/ets/tests/ets-common-tests/re_export/export.ets index 1b4943a086..14ed1bf07f 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/re_export/export.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/re_export/export.ets @@ -17,4 +17,4 @@ tags: [not-a-test] ---*/ -export function bar():void{} +export function bar(): void {} diff --git a/static_core/plugins/ets/tests/ets-common-tests/re_export/import.ets b/static_core/plugins/ets/tests/ets-common-tests/re_export/import.ets index 907a1a847b..5c6ec06cbf 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/re_export/import.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/re_export/import.ets @@ -17,9 +17,8 @@ files: [re_export.ets] ---*/ -import * as A from "./re_export" +import * as A from './re_export' -function main() : void -{ +function main() : void { A.bar(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/re_export/re_export.ets b/static_core/plugins/ets/tests/ets-common-tests/re_export/re_export.ets index b2dab60fbc..3debd81f4a 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/re_export/re_export.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/re_export/re_export.ets @@ -18,4 +18,4 @@ files: [export.ets] ---*/ -export * from "./export" +export * from './export' diff --git a/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/import.ets b/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/import.ets index 7c988f74c5..27aa6f20a8 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/import.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/import.ets @@ -17,6 +17,6 @@ files: [re-export.ets] ---*/ -import * as all from "./re-export" +import * as all from './re-export' all.foo() diff --git a/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/re-export.ets b/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/re-export.ets index 077ecaf21c..730fd6ad28 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/re-export.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/re_export_with_alias/re-export.ets @@ -18,7 +18,7 @@ files: [export.ets] ---*/ -import {foo} from "./export" +import {foo} from './export' -export {foo as a} from "./export" -export * from "./export" +export {foo as a} from './export' +export * from './export' diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source0.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source0.ets index a9e7cd4995..45a8a9dd55 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source0.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source0.ets @@ -18,7 +18,7 @@ files: - ./source1.ets ---*/ -import {func} from "./source1" +import {func} from './source1' function main() : void { func(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source1.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source1.ets index 20735ff21c..13f25b1d5e 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source1.ets @@ -19,10 +19,10 @@ files: tags: [not-a-test] ---*/ -import {foo} from "./source2" +import {foo} from './source2' -export class A{ - a: number; +export class A { + public a: number; } export function func() { diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source2.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source2.ets index eb3f8d03c0..f8ae6c56f4 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source2.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_0/source2.ets @@ -17,7 +17,7 @@ tags: [not-a-test] ---*/ -import {A} from "./source1" +import {A} from './source1' -export function foo(a: A){} +export function foo(a: A) {} diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo0.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo0.ets index 9558df9ec8..fc9cc99d1b 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo0.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo0.ets @@ -18,8 +18,8 @@ files: - ./foo1.ets ---*/ -import {main as foo_main} from "./foo1" +import {main as fooMain} from './foo1' function main() : void { - foo_main(); + fooMain(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo1.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo1.ets index dcab69fd1b..e68bd03998 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo1.ets @@ -19,10 +19,10 @@ files: tags: [not-a-test] ---*/ -import {foo} from "./foo2" +import {foo} from './foo2' export class A { - a: int; + public a: int; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo2.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo2.ets index dc1d651994..a1a41c70bf 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo2.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_1_fail_not_called_w_module/foo2.ets @@ -18,9 +18,9 @@ files: tags: [not-a-test] ---*/ -import {A} from "./foo1" +import {A} from './foo1' export function foo(a: A): int { - console.log("in foo"); + console.log('in foo'); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo0.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo0.ets index 9558df9ec8..fc9cc99d1b 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo0.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo0.ets @@ -18,8 +18,8 @@ files: - ./foo1.ets ---*/ -import {main as foo_main} from "./foo1" +import {main as fooMain} from './foo1' function main() : void { - foo_main(); + fooMain(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo1.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo1.ets index 996b42784e..c3744a92bd 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo1.ets @@ -19,14 +19,14 @@ files: tags: [not-a-test] ---*/ -import {foo_in_3} from "./foo3" +import {fooIn3} from './foo3' export class A { - a: int; + public a: int; } export function main() : void { let a = new A(); - foo_in_3(); + fooIn3(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo2.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo2.ets index fd3ca591af..ff09458229 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo2.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo2.ets @@ -18,9 +18,9 @@ files: tags: [not-a-test] ---*/ -import {A} from "./foo1" +import {A} from './foo1' -export function foo_in_2(): int { - console.log("in foo_in_2"); +export function fooIn2(): int { + console.log('in foo_in_2'); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo3.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo3.ets index a2da17ec2b..625eb11897 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo3.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_2_3-sources-in-circle/foo3.ets @@ -19,10 +19,10 @@ files: tags: [not-a-test] ---*/ -import {foo_in_2} from "./foo2" +import {fooIn2} from './foo2' -export function foo_in_3(): int { - console.log("in foo_in_3"); - foo_in_2(); +export function fooIn3(): int { + console.log('in foo_in_3'); + fooIn2(); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo0.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo0.ets index dab36da6a9..7580604945 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo0.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo0.ets @@ -19,7 +19,7 @@ files: - ./foo1.ets ---*/ -import {main as foo_main} from "./foo1" +import {main as foo_main} from './foo1' function main() : void { foo_main(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo1.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo1.ets index 996b42784e..c3744a92bd 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo1.ets @@ -19,14 +19,14 @@ files: tags: [not-a-test] ---*/ -import {foo_in_3} from "./foo3" +import {fooIn3} from './foo3' export class A { - a: int; + public a: int; } export function main() : void { let a = new A(); - foo_in_3(); + fooIn3(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo2.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo2.ets index 1956c89ae9..5aefa1a990 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo2.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo2.ets @@ -17,9 +17,9 @@ tags: [not-a-test] ---*/ -import {A} from "./foo1" +import {A} from './foo1' -export function foo_in_2(): int { - console.log("in foo_in_2"); +export function fooIn2(): int { + console.log('in foo_in_2'); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo3.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo3.ets index a2da17ec2b..625eb11897 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo3.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_3_3-sources-in-circle-fail-no-ets-module-compile/foo3.ets @@ -19,10 +19,10 @@ files: tags: [not-a-test] ---*/ -import {foo_in_2} from "./foo2" +import {fooIn2} from './foo2' -export function foo_in_3(): int { - console.log("in foo_in_3"); - foo_in_2(); +export function fooIn3(): int { + console.log('in foo_in_3'); + fooIn2(); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo0.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo0.ets index 9558df9ec8..f3729ad7e0 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo0.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo0.ets @@ -18,7 +18,7 @@ files: - ./foo1.ets ---*/ -import {main as foo_main} from "./foo1" +import {main as foo_main} from './foo1' function main() : void { foo_main(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo1.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo1.ets index 996b42784e..c3744a92bd 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo1.ets @@ -19,14 +19,14 @@ files: tags: [not-a-test] ---*/ -import {foo_in_3} from "./foo3" +import {fooIn3} from './foo3' export class A { - a: int; + public a: int; } export function main() : void { let a = new A(); - foo_in_3(); + fooIn3(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo2.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo2.ets index 1956c89ae9..5aefa1a990 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo2.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo2.ets @@ -17,9 +17,9 @@ tags: [not-a-test] ---*/ -import {A} from "./foo1" +import {A} from './foo1' -export function foo_in_2(): int { - console.log("in foo_in_2"); +export function fooIn2(): int { + console.log('in foo_in_2'); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo3.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo3.ets index a2da17ec2b..625eb11897 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo3.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_4_3-sources-in-circle_no-ets-module-compile_2/foo3.ets @@ -19,10 +19,10 @@ files: tags: [not-a-test] ---*/ -import {foo_in_2} from "./foo2" +import {fooIn2} from './foo2' -export function foo_in_3(): int { - console.log("in foo_in_3"); - foo_in_2(); +export function fooIn3(): int { + console.log('in foo_in_3'); + fooIn2(); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo0.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo0.ets index 19b8aa39b0..4e9717228a 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo0.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo0.ets @@ -17,7 +17,7 @@ files: [foo1.ets] ---*/ -import {main as foo_main} from "./foo1" +import {main as foo_main} from './foo1' function main() : void { foo_main(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo1.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo1.ets index ce517757c9..607aa50e16 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo1.ets @@ -19,7 +19,7 @@ files: tags: [not-a-test] ---*/ -import {foo_in_2} from "./foo2" +import {foo_in_2} from './foo2' export function main() : void { foo_in_2(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo2.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo2.ets index 71464e9e53..76ac03b9fa 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo2.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo2.ets @@ -19,12 +19,12 @@ files: tags: [not-a-test] ---*/ -import {foo_in_3} from "./foo3" +import {foo_in_3} from './foo3' export class A {} export function foo_in_2(): int { - console.log("in foo_in_2"); + console.log('in foo_in_2'); foo_in_3(); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo3.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo3.ets index b06aca9658..9d40dd3232 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo3.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/case_5_main-is-not-part-of-circle/foo3.ets @@ -17,10 +17,10 @@ tags: [not-a-test] ---*/ -import {A} from "./foo2" +import {A} from './foo2' export function foo_in_3(): int { let a = new A(); - console.log("in foo_in_3") + console.log('in foo_in_3') return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/recursive_import_binds_all.ets b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/recursive_import_binds_all.ets index b104dec00f..eda5b88641 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/recursive_import/recursive_import_binds_all.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/recursive_import/recursive_import_binds_all.ets @@ -18,8 +18,8 @@ files: - ./packages/recursive/package_module_1.ets ---*/ -import * as all from "./packages/recursive"; +import * as all from './packages/recursive'; function main(): void { - assertEQ(all.a, "hello"); + assertEQ(all.a, 'hello'); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/runtime_types/functions.ets b/static_core/plugins/ets/tests/ets-common-tests/runtime_types/functions.ets index a9b5c6f367..8fc712d359 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/runtime_types/functions.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/runtime_types/functions.ets @@ -16,7 +16,7 @@ function xassert(a: Any, b: Any) { return assertEQ(a, b) } function fakeLambdaInvoke(a: string, b: string | undefined): string { - return a + (b === undefined ? "u" : b); + return a + (b === undefined ? 'u' : b); } class FakeLambdaObject extends Lambda2 implements Function1 { @@ -41,16 +41,16 @@ class FakeLambdaObject extends Lambda2 implements Function1 { } function testF1(f: Function1) { - xassert(f.invoke1("a"), "au") - xassert(f.invoke2("a", "b"), "ab") - xassert(f.invoke3("a", "b", "c"), "ab") - xassert(f.invokeR1("a"), "au") - xassert(f.invokeR1("a", "b"), "ab") - xassert(f.invokeR1("a", "b", "c"), "ab") - xassert(f.invokeR2("a", "b"), "ab") - xassert(f.invokeR2("a", "b", "c"), "ab") - xassert(f.invokeR3("a", "b", "c"), "ab") - xassert(f.invokeR3("a", "b", "c", "d"), "ab") + xassert(f.invoke1('a'), 'au') + xassert(f.invoke2('a', 'b'), 'ab') + xassert(f.invoke3('a', 'b', 'c'), 'ab') + xassert(f.invokeR1('a'), 'au') + xassert(f.invokeR1('a', 'b'), 'ab') + xassert(f.invokeR1('a', 'b', 'c'), 'ab') + xassert(f.invokeR2('a', 'b'), 'ab') + xassert(f.invokeR2('a', 'b', 'c'), 'ab') + xassert(f.invokeR3('a', 'b', 'c'), 'ab') + xassert(f.invokeR3('a', 'b', 'c', 'd'), 'ab') } function main() { diff --git a/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/import_selective_exported.ets b/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/import_selective_exported.ets index 1eb975c2c5..f94536a974 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/import_selective_exported.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/import_selective_exported.ets @@ -18,17 +18,17 @@ files: - ./selective_export.ets ---*/ -import * as all from "./selective_export" -import {func} from "./selective_export" +import * as all from './selective_export' +import {func} from './selective_export' function main(): void { func(); console.print(all.msg); - let test_var: all.tc = new all.tc(); - console.print(test_var.test_member); - test_var.test_method(); + let testVar: all.tc = new all.tc(); + console.print(testVar.testMember); + testVar.testMethod(); - let alias_var = new all.aliased(); - alias_var.alias_class_method(); + let aliasVar = new all.aliased(); + aliasVar.aliasClassMethod(); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/selective_export.ets b/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/selective_export.ets index 2f41176459..9899907d94 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/selective_export.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/selective_export_with_alias/selective_export.ets @@ -17,26 +17,26 @@ tags: [not-a-test] ---*/ -function test_func(): void {} +function testFunc(): void {} -let msg = "hello"; +let msg = 'hello'; class TestClass { - test_member = "test_member"; + public testMember = 'test_member'; - test_method(): void {} + testMethod(): void {} } class AliasClass { - alias_class_method(): void { - console.print("alias_class_method"); + aliasClassMethod(): void { + console.print('alias_class_method'); } } type aliased = AliasClass; export { - test_func as func, msg, + testFunc as func, msg, TestClass as tc, aliased } diff --git a/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/import.ets b/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/import.ets index 0513c0562d..008490d222 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/import.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/import.ets @@ -18,7 +18,7 @@ files: - ./re-export.ets ---*/ -import {test_func} from "./re-export" +import {test_func} from './re-export' function main(): void { test_func() diff --git a/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/re-export.ets b/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/re-export.ets index cd6ce68e76..2d3c08dec4 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/re-export.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/selective_re-export/re-export.ets @@ -19,6 +19,6 @@ files: [./export.ets] tags: [not-a-test] ---*/ -import {test_func} from "./export" +import {test_func} from './export' export {test_func} diff --git a/static_core/plugins/ets/tests/ets-common-tests/single_export/sourceA.ets b/static_core/plugins/ets/tests/ets-common-tests/single_export/sourceA.ets index 6e99049e14..0ea915bac6 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/single_export/sourceA.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/single_export/sourceA.ets @@ -18,8 +18,8 @@ files: - ./sourceB.ets ---*/ -import {v} from "./sourceB.ets" -import * as all from "./sourceB.ets" +import {v} from './sourceB.ets' +import * as all from './sourceB.ets' function main() : void { assertEQ(5, v()); diff --git a/static_core/plugins/ets/tests/ets-common-tests/stubs/equals.ets b/static_core/plugins/ets/tests/ets-common-tests/stubs/equals.ets index af92dd2a1a..e45c602ea8 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/stubs/equals.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/stubs/equals.ets @@ -38,8 +38,8 @@ enum Color64 { } enum ColorString { - RED = "", - GREEN = "GREEN" + RED = '', + GREEN = 'GREEN' } function testNormal() { @@ -96,4 +96,4 @@ function testErase() { function main() { testNormal(); testErase(); -} \ No newline at end of file +} diff --git a/static_core/plugins/ets/tests/ets-common-tests/stubs/istrue.ets b/static_core/plugins/ets/tests/ets-common-tests/stubs/istrue.ets index d045e15ad9..d52120999f 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/stubs/istrue.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/stubs/istrue.ets @@ -20,15 +20,15 @@ function erase(v: T): Any { } class Klass { - public f:number; + public f: number; constructor(f:number) { - this.f= f; + this.f = f; } } function foo(n: number): Klass | undefined { - if(n == 0){ + if (n == 0) { return undefined; } return new Klass(n); @@ -49,8 +49,8 @@ enum Color64 { } enum ColorString { - Red = "", - Green = "Green" + Red = '', + Green = 'Green' } function testNormal() { @@ -68,8 +68,8 @@ function testNormal() { assertTrue(istrue(new Double(0.5))); assertTrue(!istrue(new Char(0 as char))); assertTrue(istrue(new Char(c'0'))); - assertTrue(!istrue("")); - assertTrue(istrue("Hello")); + assertTrue(!istrue('')); + assertTrue(istrue('Hello')); assertTrue(!istrue(false)); assertTrue(istrue(true)); assertTrue(!istrue(null)); @@ -108,8 +108,8 @@ function testErase() { assertTrue(istrue(erase(new Double(0.5)))); assertTrue(!istrue(erase(new Char(0 as char)))); assertTrue(istrue(erase(new Char(c'0')))); - assertTrue(!istrue(erase(""))); - assertTrue(istrue(erase("Hello"))); + assertTrue(!istrue(erase(''))); + assertTrue(istrue(erase('Hello'))); assertTrue(!istrue(erase(false))); assertTrue(istrue(erase(true))); assertTrue(!istrue(erase(null))); diff --git a/static_core/plugins/ets/tests/ets-common-tests/taskpool/func_tasks.ets b/static_core/plugins/ets/tests/ets-common-tests/taskpool/func_tasks.ets index 0af59e3c5a..46016b304c 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/taskpool/func_tasks.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/taskpool/func_tasks.ets @@ -13,62 +13,62 @@ * limitations under the License. */ -function SumInt(value1: int, value2: int): int { +function sumInt(value1: int, value2: int): int { return value1 + value2; } -function TaskpoolFuncTestSumInt() { - let result = await taskpool.execute(SumInt, 10, 20); +function taskpoolFuncTestSumInt() { + let result = await taskpool.execute(sumInt, 10, 20); assertEQ(result, 30); } -function TaskpoolFuncTestAnd() { - let And = (value1: boolean, value2: boolean): boolean => { +function taskpoolFuncTestAnd() { + let and = (value1: boolean, value2: boolean): boolean => { if (value1 & value2) { return true; } return false; } - let result = await taskpool.execute(And, true, true); + let result = await taskpool.execute(and, true, true); assertEQ(result, true); } -function TaskpoolFuncTestStrCat() { - let StrCat = (value1: string, value2: string): string => { +function taskpoolFuncTestStrCat() { + let strCat = (value1: string, value2: string): string => { return value1 + value2; } - let result = await taskpool.execute(StrCat, "abc", "def"); - assertEQ(result, "abcdef"); + let result = await taskpool.execute(strCat, 'abc', 'def'); + assertEQ(result, 'abcdef'); } -function TaskpoolFuncTestStrCat2() { - let StrCat = (value1: string, value2: string): string => { +function taskpoolFuncTestStrCat2() { + let strCat = (value1: string, value2: string): string => { return value1 + value2; } - let result = await taskpool.execute(StrCat, "abc", "def"); - result = await taskpool.execute(StrCat, "abc", "def"); - assertEQ(result, "abcdef"); + let result = await taskpool.execute(strCat, 'abc', 'def'); + result = await taskpool.execute(strCat, 'abc', 'def'); + assertEQ(result, 'abcdef'); } -function TaskpoolFuncTestStrCat3() { - let StrCat = (value1: string, value2: string): string => { +function taskpoolFuncTestStrCat3() { + let strCat = (value1: string, value2: string): string => { return value1 + value2; } - let Sum = (value1: string, value2: string): string => { - return value1 + StrCat(value2, "hello"); + let sum = (value1: string, value2: string): string => { + return value1 + strCat(value2, 'hello'); } - let result = await taskpool.execute(Sum, "abc", "def"); - assertEQ(result, "abcdefhello"); + let result = await taskpool.execute(sum, 'abc', 'def'); + assertEQ(result, 'abcdefhello'); } -function TaskpoolFuncTestArraySum() { - let Sum = (value1: int[], value2: int[]): int[] => { +function taskpoolFuncTestArraySum() { + let sum = (value1: int[], value2: int[]): int[] => { let result: int[] = [0, 0]; result[0] = value1[0] + value2[0]; result[1] = value1[1] + value2[1]; return result; } - let result = (await taskpool.execute(Sum, [1, 2], [3, 4])) as int[]; + let result = (await taskpool.execute(sum, [1, 2], [3, 4])) as int[]; assertEQ(result[0], 4); assertEQ(result[1], 6); } @@ -76,44 +76,44 @@ function TaskpoolFuncTestArraySum() { class A { constructor(a: int, b: int) { this.a = a; this.b = b; } constructor() { this(0, 0); } - a: int; - b: int; + public a: int; + public b: int; } -function TaskpoolFuncTestClassFieldsSum() { - let Sum = (value1: A, value2: A): A => { +function taskpoolFuncTestClassFieldsSum() { + let sum = (value1: A, value2: A): A => { let result = new A(); result.a = value1.a + value2.a; result.b = value1.b + value2.b; return result; } - let result = (await taskpool.execute(Sum, new A(1, 2), new A(3, 4))) as A; + let result = (await taskpool.execute(sum, new A(1, 2), new A(3, 4))) as A; assertEQ(result.a, 4); assertEQ(result.b, 6); } -function TaskpoolFuncTestSumInt2() { - let result1 = await taskpool.execute(SumInt, 10, 20); - let result2 = await taskpool.execute(SumInt, 30, 40); +function taskpoolFuncTestSumInt2() { + let result1 = await taskpool.execute(sumInt, 10, 20); + let result2 = await taskpool.execute(sumInt, 30, 40); assertEQ(result1, 30); assertEQ(result2, 70); } -function TaskpoolFuncTestSumInt2SameArguments() { - let result1 = await taskpool.execute(SumInt, 10, 20); - let result2 = await taskpool.execute(SumInt, 10, 20); +function taskpoolFuncTestSumInt2SameArguments() { + let result1 = await taskpool.execute(sumInt, 10, 20); + let result2 = await taskpool.execute(sumInt, 10, 20); assertEQ(result1, 30); assertEQ(result2, 30); } -function TaskpoolFuncTestSumAndMulti() { - let MultiInt = (value1: int, value2: int): int => { +function taskpoolFuncTestSumAndMulti() { + let multiInt = (value1: int, value2: int): int => { return value1 * value2; } - let result1 = await taskpool.execute(SumInt, 10, 20); - let result2 = await taskpool.execute(MultiInt, 10, 20); - let result3 = await taskpool.execute(SumInt, 10, 30); - let result4 = await taskpool.execute(MultiInt, 20, 20); + let result1 = await taskpool.execute(sumInt, 10, 20); + let result2 = await taskpool.execute(multiInt, 10, 20); + let result3 = await taskpool.execute(sumInt, 10, 30); + let result4 = await taskpool.execute(multiInt, 20, 20); assertEQ(result1, 30); assertEQ(result2, 200); assertEQ(result3, 40); @@ -121,16 +121,16 @@ function TaskpoolFuncTestSumAndMulti() { } function main(): int { - TaskpoolFuncTestSumInt(); - TaskpoolFuncTestAnd(); - TaskpoolFuncTestStrCat(); - TaskpoolFuncTestStrCat2(); - TaskpoolFuncTestStrCat3(); - TaskpoolFuncTestArraySum(); - TaskpoolFuncTestClassFieldsSum(); - TaskpoolFuncTestSumInt2(); - TaskpoolFuncTestSumInt2SameArguments(); - TaskpoolFuncTestSumAndMulti(); + taskpoolFuncTestSumInt(); + taskpoolFuncTestAnd(); + taskpoolFuncTestStrCat(); + taskpoolFuncTestStrCat2(); + taskpoolFuncTestStrCat3(); + taskpoolFuncTestArraySum(); + taskpoolFuncTestClassFieldsSum(); + taskpoolFuncTestSumInt2(); + taskpoolFuncTestSumInt2SameArguments(); + taskpoolFuncTestSumAndMulti(); CoroutineExtras.stopTaskpool(); return 0; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/A/src/main/ets/a1.ets b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/A/src/main/ets/a1.ets index ae6f5bed00..6828be3c5d 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/A/src/main/ets/a1.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/A/src/main/ets/a1.ets @@ -18,9 +18,9 @@ arktsconfig: ../../../arktsconfig.json ---*/ -import {fooIA} from "HarA" -import {fooIB} from "HarB" -import {B} from "HarB/pages/b" +import {fooIA} from 'HarA' +import {fooIB} from 'HarB' +import {B} from 'HarB/pages/b' function main() { fooIA() diff --git a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/indexB.ets b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/indexB.ets index a5eca7f2fa..234d92bcf5 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/indexB.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/indexB.ets @@ -19,7 +19,7 @@ arktsconfig: arktsconfig.json ---*/ -import {fooIC} from "HarC" +import {fooIC} from 'HarC' export function fooIB() { fooIC() } diff --git a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/src/main/ets/pages/b.ets b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/src/main/ets/pages/b.ets index 15d191dc65..65eb05e6bc 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/src/main/ets/pages/b.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_field_dependencies_and_entry/B/src/main/ets/pages/b.ets @@ -19,7 +19,7 @@ arktsconfig: ../../../../arktsconfig.json ---*/ -import {C} from "HarC/pages/c" +import {C} from 'HarC/pages/c' export class B { - x: C = new C() + public x: C = new C() } diff --git a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirA/a.ets b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirA/a.ets index 3409b5336e..71682f51bf 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirA/a.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirA/a.ets @@ -18,7 +18,7 @@ arktsconfig: arktsconfig.json ---*/ -import { BObj } from "HarB.foo" +import { BObj } from 'HarB.foo' function main() { BObj.foo(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirB/foo.ets b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirB/foo.ets index 4eb9e4d648..bb8b77cd2e 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirB/foo.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/testing_arktsconfig_paths_single_file/dirB/foo.ets @@ -20,7 +20,7 @@ export class BObj { - static foo(){ + static foo() { assertEQ(1, 1) } } diff --git a/static_core/plugins/ets/tests/ets-common-tests/testing_varying_arktsconfigs/package_names/test_01/dir/foo.ets b/static_core/plugins/ets/tests/ets-common-tests/testing_varying_arktsconfigs/package_names/test_01/dir/foo.ets index b2ca17e1b5..c92daf63a5 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/testing_varying_arktsconfigs/package_names/test_01/dir/foo.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/testing_varying_arktsconfigs/package_names/test_01/dir/foo.ets @@ -18,7 +18,7 @@ arktsconfig: arktsconfig.json ---*/ -import { bar } from "@dir_with_same_prefix/bar" +import { bar } from '@dir_with_same_prefix/bar' function main() { bar(); diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_class_01.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_class_01.ets index 96e37aea74..7170d15e0f 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_class_01.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_class_01.ets @@ -14,10 +14,10 @@ */ class TestClass { - tmp:String = "123" + public tmp: String = '123' } class TestClass1 { - tmp:String = "234" + public tmp: String = '234' } function foo(a: TestClass | TestClass1) { console.println(a.tmp) diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access.ets index 5fcb9d01d6..c99e7badb9 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access.ets @@ -14,35 +14,35 @@ */ class TestClass { - prop1:String = "123"; - prop2:Int = 123; - prop3:Byte = 12; - prop4:Long = 456; - prop5:Short = 13; + public prop1: String = '123'; + public prop2: Int = 123; + public prop3: Byte = 12; + public prop4: Long = 456; + public prop5: Short = 13; } class TestClass1 { - prop1:String = "345"; - prop2:Int = 321; - prop3:Byte = 14; - prop4:Long = 654; - prop5:Short = 15; + public prop1: String = '345'; + public prop2: Int = 321; + public prop3: Byte = 14; + public prop4: Long = 654; + public prop5: Short = 15; } function test(a: TestClass | TestClass1) { - assertEQ(a.prop1, "123", "expected \"123\", but got " + a.prop1); - a.prop1 = "234" - assertEQ(a.prop1, "234", "expected \"234\", but got " + a.prop1); - assertEQ(a.prop2, 123, "expected 123, but got " + a.prop2); + assertEQ(a.prop1, '123', 'expected \'123\', but got ' + a.prop1); + a.prop1 = '234' + assertEQ(a.prop1, '234', 'expected \'234\', but got ' + a.prop1); + assertEQ(a.prop2, 123, 'expected 123, but got ' + a.prop2); a.prop2 = 234 - assertEQ(a.prop2, 234, "expected 234, but got " + a.prop2); - assertEQ(a.prop3, 12, "expected 12, but got " + a.prop3); + assertEQ(a.prop2, 234, 'expected 234, but got ' + a.prop2); + assertEQ(a.prop3, 12, 'expected 12, but got ' + a.prop3); a.prop3 = 13 - assertEQ(a.prop3, 13, "expected 13, but got " + a.prop3); - assertEQ(a.prop4, 456, "expected 456, but got " + a.prop4); + assertEQ(a.prop3, 13, 'expected 13, but got ' + a.prop3); + assertEQ(a.prop4, 456, 'expected 456, but got ' + a.prop4); a.prop4 = 567 - assertEQ(a.prop4, 567, "expected 567, but got " + a.prop4); - assertEQ(a.prop5, 13, "expected 13, but got " + a.prop5); + assertEQ(a.prop4, 567, 'expected 567, but got ' + a.prop4); + assertEQ(a.prop5, 13, 'expected 13, but got ' + a.prop5); a.prop5 = 14 - assertEQ(a.prop5, 14, "expected 14, but got " + a.prop5); + assertEQ(a.prop5, 14, 'expected 14, but got ' + a.prop5); return 0; } @@ -50,4 +50,4 @@ function test(a: TestClass | TestClass1) { function main() { let a = new TestClass() return test(a) -} \ No newline at end of file +} diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access_with_inheritance.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access_with_inheritance.ets index b2635891d0..abd356a293 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access_with_inheritance.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_field_access_with_inheritance.ets @@ -14,44 +14,44 @@ */ class TestClass { - prop1:String = "123"; - prop2:Int = 123; - prop3:Byte = 12; - prop4:Long = 456; - prop5:Short = 13; + public prop1: String = '123'; + public prop2: Int = 123; + public prop3: Byte = 12; + public prop4: Long = 456; + public prop5: Short = 13; } class TestClass1 { - prop1:String = "345"; - prop2:Int = 321; - prop3:Byte = 14; - prop4:Long = 654; - prop5:Short = 15; + public prop1: String = '345'; + public prop2: Int = 321; + public prop3: Byte = 14; + public prop4: Long = 654; + public prop5: Short = 15; } class TestClass2 extends TestClass { } class TestClass3 extends TestClass1 { } function test(a: TestClass2 | TestClass3) { - assertEQ(a.prop1, "123", "expected \"123\", but got " + a.prop1); - a.prop1 = "234" - assertEQ(a.prop1, "234", "expected \"234\", but got " + a.prop1); - assertEQ(a.prop2, 123, "expected 123, but got " + a.prop2); + assertEQ(a.prop1, '123', 'expected \'123\', but got ' + a.prop1); + a.prop1 = '234' + assertEQ(a.prop1, '234', 'expected \'234\', but got ' + a.prop1); + assertEQ(a.prop2, 123, 'expected 123, but got ' + a.prop2); a.prop2 = 234 - assertEQ(a.prop2, 234, "expected 234, but got " + a.prop2); - assertEQ(a.prop3, 12, "expected 12, but got " + a.prop3); + assertEQ(a.prop2, 234, 'expected 234, but got ' + a.prop2); + assertEQ(a.prop3, 12, 'expected 12, but got ' + a.prop3); a.prop3 = 13 - assertEQ(a.prop3, 13, "expected 13, but got " + a.prop3); - assertEQ(a.prop4, 456, "expected 456, but got " + a.prop4); + assertEQ(a.prop3, 13, 'expected 13, but got ' + a.prop3); + assertEQ(a.prop4, 456, 'expected 456, but got ' + a.prop4); a.prop4 = 567 - assertEQ(a.prop4, 567, "expected 567, but got " + a.prop4); - assertEQ(a.prop5, 13, "expected 13, but got " + a.prop5); + assertEQ(a.prop4, 567, 'expected 567, but got ' + a.prop4); + assertEQ(a.prop5, 13, 'expected 13, but got ' + a.prop5); a.prop5 = 14 - assertEQ(a.prop5, 14, "expected 14, but got " + a.prop5); + assertEQ(a.prop5, 14, 'expected 14, but got ' + a.prop5); return 0; } function main() { let a = new TestClass2() return test(a) -} \ No newline at end of file +} diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter.ets index 2ce3cdf1a4..75b50f0919 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter.ets @@ -14,35 +14,35 @@ */ class TestClass { - prop1_:String = "123"; + public prop1_: String = '123'; get prop1():String { return this.prop1_; } set prop1(i:String) { this.prop1_ = i } - prop2_:Int = 123; + public prop2_: Int = 123; get prop2():Int { return this.prop2_; } set prop2(i:Int) { this.prop2_ = i } - prop3_:Byte = 12; + public prop3_: Byte = 12; get prop3():Byte { return this.prop3_; } set prop3(i:Byte) { this.prop3_ = i } - prop4_:Long = 456; + public prop4_: Long = 456; get prop4():Long { return this.prop4_; } set prop4(i:Long) { this.prop4_ = i } - prop5_:Short = 13; + public prop5_: Short = 13; get prop5():Short { return this.prop5_; } @@ -51,35 +51,35 @@ class TestClass { } } class TestClass1 { - prop1_:String = "345"; + public prop1_: String = '345'; get prop1():String { return this.prop1_; } set prop1(i:String) { this.prop1_ = i } - prop2_:Int = 321; + public prop2_: Int = 321; get prop2():Int { return this.prop2_; } set prop2(i:Int) { this.prop2_ = i } - prop3_:Byte = 14; + public prop3_: Byte = 14; get prop3():Byte { return this.prop3_; } set prop3(i:Byte) { this.prop3_ = i } - prop4_:Long = 654; + public prop4_: Long = 654; get prop4():Long { return this.prop4_; } set prop4(i:Long) { this.prop4_ = i } - prop5_:Short = 15; + public prop5_: Short = 15; get prop5():Short { return this.prop5_; } @@ -89,25 +89,25 @@ class TestClass1 { } function test(a: TestClass | TestClass1) { - assertEQ(a.prop1, "123", "expected \"123\", but got " + a.prop1); - a.prop1 = "234" - assertEQ(a.prop1, "234", "expected \"234\", but got " + a.prop1); - assertEQ(a.prop2, 123, "expected 123, but got " + a.prop2); + assertEQ(a.prop1, '123', 'expected \'123\', but got ' + a.prop1); + a.prop1 = '234' + assertEQ(a.prop1, '234', 'expected \'234\', but got ' + a.prop1); + assertEQ(a.prop2, 123, 'expected 123, but got ' + a.prop2); a.prop2 = 234 - assertEQ(a.prop2, 234, "expected 234, but got " + a.prop2); - assertEQ(a.prop3, 12, "expected 12, but got " + a.prop3); + assertEQ(a.prop2, 234, 'expected 234, but got ' + a.prop2); + assertEQ(a.prop3, 12, 'expected 12, but got ' + a.prop3); a.prop3 = 13 - assertEQ(a.prop3, 13, "expected 13, but got " + a.prop3); - assertEQ(a.prop4, 456, "expected 456, but got " + a.prop4); + assertEQ(a.prop3, 13, 'expected 13, but got ' + a.prop3); + assertEQ(a.prop4, 456, 'expected 456, but got ' + a.prop4); a.prop4 = 567 - assertEQ(a.prop4, 567, "expected 567, but got " + a.prop4); - assertEQ(a.prop5, 13, "expected 13, but got " + a.prop5); + assertEQ(a.prop4, 567, 'expected 567, but got ' + a.prop4); + assertEQ(a.prop5, 13, 'expected 13, but got ' + a.prop5); a.prop5 = 14 - assertEQ(a.prop5, 14, "expected 14, but got " + a.prop5); + assertEQ(a.prop5, 14, 'expected 14, but got ' + a.prop5); return 0; } function main() { let a = new TestClass() return test(a) -} \ No newline at end of file +} diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter_with_inheritance.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter_with_inheritance.ets index 7b8dae339f..3ad0dd0457 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter_with_inheritance.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_getter_setter_with_inheritance.ets @@ -14,35 +14,35 @@ */ class TestClass { - prop1_:String = "123"; + public prop1_: String = '123'; get prop1():String { return this.prop1_; } set prop1(i:String) { this.prop1_ = i } - prop2_:Int = 123; + public prop2_:Int = 123; get prop2():Int { return this.prop2_; } set prop2(i:Int) { this.prop2_ = i } - prop3_:Byte = 12; + public prop3_: Byte = 12; get prop3():Byte { return this.prop3_; } set prop3(i:Byte) { this.prop3_ = i } - prop4_:Long = 456; + public prop4_: Long = 456; get prop4():Long { return this.prop4_; } set prop4(i:Long) { this.prop4_ = i } - prop5_:Short = 13; + public prop5_: Short = 13; get prop5():Short { return this.prop5_; } @@ -52,35 +52,35 @@ class TestClass { } class TestClass1 { - prop1_:String = "345"; + public prop1_: String = '345'; get prop1():String { return this.prop1_; } set prop1(i:String) { this.prop1_ = i } - prop2_:Int = 321; + public prop2_: Int = 321; get prop2():Int { return this.prop2_; } set prop2(i:Int) { this.prop2_ = i } - prop3_:Byte = 14; + public prop3_: Byte = 14; get prop3():Byte { return this.prop3_; } set prop3(i:Byte) { this.prop3_ = i } - prop4_:Long = 654; + public prop4_: Long = 654; get prop4():Long { return this.prop4_; } set prop4(i:Long) { this.prop4_ = i } - prop5_:Short = 15; + public prop5_: Short = 15; get prop5():Short { return this.prop5_; } @@ -97,25 +97,25 @@ class TestClass3 extends TestClass1 { } function test(a: TestClass2 | TestClass3) { - assertEQ(a.prop1, "123", "expected \"123\", but got " + a.prop1); - a.prop1 = "234" - assertEQ(a.prop1, "234", "expected \"234\", but got " + a.prop1); - assertEQ(a.prop2, 123, "expected 123, but got " + a.prop2); + assertEQ(a.prop1, '123', 'expected \'123\', but got ' + a.prop1); + a.prop1 = '234' + assertEQ(a.prop1, '234', 'expected \'234\', but got ' + a.prop1); + assertEQ(a.prop2, 123, 'expected 123, but got ' + a.prop2); a.prop2 = 234 - assertEQ(a.prop2, 234, "expected 234, but got " + a.prop2); - assertEQ(a.prop3, 12, "expected 12, but got " + a.prop3); + assertEQ(a.prop2, 234, 'expected 234, but got ' + a.prop2); + assertEQ(a.prop3, 12, 'expected 12, but got ' + a.prop3); a.prop3 = 13 - assertEQ(a.prop3, 13, "expected 13, but got " + a.prop3); - assertEQ(a.prop4, 456, "expected 456, but got " + a.prop4); + assertEQ(a.prop3, 13, 'expected 13, but got ' + a.prop3); + assertEQ(a.prop4, 456, 'expected 456, but got ' + a.prop4); a.prop4 = 567 - assertEQ(a.prop4, 567, "expected 567, but got " + a.prop4); - assertEQ(a.prop5, 13, "expected 13, but got " + a.prop5); + assertEQ(a.prop4, 567, 'expected 567, but got ' + a.prop4); + assertEQ(a.prop5, 13, 'expected 13, but got ' + a.prop5); a.prop5 = 14 - assertEQ(a.prop5, 14, "expected 14, but got " + a.prop5); + assertEQ(a.prop5, 14, 'expected 14, but got ' + a.prop5); return 0; } function main() { let a = new TestClass2() return test(a) -} \ No newline at end of file +} diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method.ets index 9cbfd7e64f..4c61777cef 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method.ets @@ -14,34 +14,34 @@ */ class A { - foo(v: String): String { return ("A:" + v) } + foo(v: String): String { return ('A:' + v) } } class B extends A { - foo(v: String): String { return ("B:" + v) } + foo(v: String): String { return ('B:' + v) } } class C { - foo(v: String): String { return ("C:" + v) } + foo(v: String): String { return ('C:' + v) } } class D extends C {} function test1(v: A | C): String { - return v.foo("123") + return v.foo('123') } function test2(v: B | C): String { - return v.foo("123") + return v.foo('123') } function test3(v: B | D): String { - return v.foo("123") + return v.foo('123') } function main() { - assertEQ(test1(new A()), "A:123"); - assertEQ(test1(new C()), "C:123"); - assertEQ(test2(new B()), "B:123"); - assertEQ(test3(new D()), "C:123"); + assertEQ(test1(new A()), 'A:123'); + assertEQ(test1(new C()), 'C:123'); + assertEQ(test2(new B()), 'B:123'); + assertEQ(test3(new D()), 'C:123'); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_common.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_common.ets index 2b5ff551ea..8eef9ef851 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_common.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_common.ets @@ -21,8 +21,8 @@ class B { meth(p: number): number { return p + 33.0 } } -let u1: A|B = new A -let u2: A|B = new B +let u1: A | B = new A +let u2: A | B = new B function main() { assertEQ(u1.meth(1.0), 43.0); diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_dummy_interface.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_dummy_interface.ets index 640c1ee3c6..e40b1a93bd 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_dummy_interface.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_dummy_interface.ets @@ -18,25 +18,25 @@ interface I2 {} interface I3 extends I1, I2 {} class Dummy { - m(p: I3): String { return ("Dummy") } + m(p: I3): String { return ('Dummy') } } class A1 { - m(p: I3): String { return ("A1") } + m(p: I3): String { return ('A1') } } class A2 extends A1 { - m(p: I1): String { return ("A2") } + m(p: I1): String { return ('A2') } } class A3 extends A2 { - m(p: I2): String { return ("A3") } + m(p: I2): String { return ('A3') } } function test(c: A1 | Dummy, a: I3): String { return c.m(a) } function main() { - assertEQ(test(new A1(), {}), "A1"); - assertEQ(test(new A2(), {}), "A2"); - assertEQ(test(new A3(), {}), "A2"); + assertEQ(test(new A1(), {}), 'A1'); + assertEQ(test(new A2(), {}), 'A2'); + assertEQ(test(new A3(), {}), 'A2'); } diff --git a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_short_long_range.ets b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_short_long_range.ets index d88f29fdd6..407e619470 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_short_long_range.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/unions/union_method_short_long_range.ets @@ -14,23 +14,23 @@ */ class A { - foo1(v: String): String { return ("A:" + v) } - foo2(v1: String, v2: String, v3: String): String { return ("A:" + v1 + "_" + v2 + "_" + v3) } - foo3(v1: int, v2: int, v3: int, v4:int, v5:int): String { return "A:" + (v1 + v2 + v3 + v4 + v5) } + foo1(v: String): String { return ('A:' + v) } + foo2(v1: String, v2: String, v3: String): String { return ('A:' + v1 + '_' + v2 + '_' + v3) } + foo3(v1: int, v2: int, v3: int, v4:int, v5:int): String { return 'A:' + (v1 + v2 + v3 + v4 + v5) } } class B { - foo1(v: String): String { return ("B:" + v) } - foo2(v1: String, v2: String, v3: String): String { return ("B:" + v1 + "_" + v2 + "_" + v3) } - foo3(v1: int, v2: int, v3: int, v4:int, v5:int): String { return "B:" + (v1 + v2 + v3 + v4 + v5) } + foo1(v: String): String { return ('B:' + v) } + foo2(v1: String, v2: String, v3: String): String { return ('B:' + v1 + '_' + v2 + '_' + v3) } + foo3(v1: int, v2: int, v3: int, v4:int, v5:int): String { return 'B:' + (v1 + v2 + v3 + v4 + v5) } } function test1(v: A | B): String { - return v.foo1("abc") + return v.foo1('abc') } function test2(v: A | B): String { - return v.foo2("a", "b", "c") + return v.foo2('a', 'b', 'c') } function test3(v: A | B): String { @@ -40,10 +40,10 @@ function test3(v: A | B): String { function main() { let a = new A() let b = new B() - assertEQ(test1(a), "A:abc"); - assertEQ(test1(b), "B:abc"); - assertEQ(test2(a), "A:a_b_c"); - assertEQ(test2(b), "B:a_b_c"); - assertEQ(test3(a), "A:15"); - assertEQ(test3(b), "B:15"); + assertEQ(test1(a), 'A:abc'); + assertEQ(test1(b), 'B:abc'); + assertEQ(test2(a), 'A:a_b_c'); + assertEQ(test2(b), 'B:a_b_c'); + assertEQ(test3(a), 'A:15'); + assertEQ(test3(b), 'B:15'); } -- Gitee From 4ba006c50a00ee5737b1ed4e2b992d62223c833b Mon Sep 17 00:00:00 2001 From: Artem Udovichenko Date: Wed, 11 Jun 2025 14:58:43 +0300 Subject: [PATCH 2/3] Fix1 Change-Id: Ibb35ef91dbe4ff48d67cf0a90584dcb6531d5589 Signed-off-by: Artem Udovichenko --- .../ets/tests/ets-common-tests/intrinsics/string_hashcode.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets index 212c86e81d..bb7a06367d 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/string_hashcode.ets @@ -135,12 +135,12 @@ function main(): int { let hcA: String = new String(hashCollisionA); let hcB: String = new String(hashCollisionB); if (hcA.$_hashCode() != 31) { - console.println('hcA hashcode: ' + hc_a.$_hashCode()); + console.println('hcA hashcode: ' + hcA.$_hashCode()); console.println('FAIL'); return 3; } if (hcA.$_hashCode() != hcB.$_hashCode()) { - console.println('hcA hashcode: ' + hc_a.$_hashCode()); + console.println('hcA hashcode: ' + hcA.$_hashCode()); console.println('hcB hashcode: ' + hcB.$_hashCode()); console.println('FAIL'); return 4; -- Gitee From b1dfcc3bd72c1bdcc378defce9f30f11a3483720 Mon Sep 17 00:00:00 2001 From: Artem Udovichenko Date: Mon, 16 Jun 2025 17:07:59 +0300 Subject: [PATCH 3/3] Try to optimize Collect Change-Id: Ic1d2bf406c700aeaeef7f910d1ce86bc4ad733c4 Signed-off-by: Artem Udovichenko --- static_core/runtime/mem/gc/bitmap.h | 8 ++++++++ .../runtime/mem/gc/g1/g1-allocator.cpp | 19 +++++++++++++++++++ static_core/runtime/mem/gc/g1/g1-gc.cpp | 5 ++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/static_core/runtime/mem/gc/bitmap.h b/static_core/runtime/mem/gc/bitmap.h index b2fd391595..ff83d827cd 100644 --- a/static_core/runtime/mem/gc/bitmap.h +++ b/static_core/runtime/mem/gc/bitmap.h @@ -52,6 +52,14 @@ public: return bitmap_; } + void Minus(Bitmap *bitmap) + { + ASSERT(Size() == bitmap->Size()); + for (size_t i = 0; i < bitmap_.Size(); ++i) { + bitmap_[i] &= ~bitmap->bitmap_[i]; + } + } + size_t GetSetBitCount() { size_t countMarkBits = 0; diff --git a/static_core/runtime/mem/gc/g1/g1-allocator.cpp b/static_core/runtime/mem/gc/g1/g1-allocator.cpp index f64210d5d1..e4b8c0a280 100644 --- a/static_core/runtime/mem/gc/g1/g1-allocator.cpp +++ b/static_core/runtime/mem/gc/g1/g1-allocator.cpp @@ -326,7 +326,26 @@ template void ObjectAllocatorG1::CollectNonRegularRegions(const RegionsVisitor ®ionVisitor, const GCObjectVisitor &gcObjectVisitor) { + //for (Region *region : nonmovableAllocator_->GetAllRegions()) { + // region->GetMarkBitmap()->IterateOverMarkedChunks([this] (void *mem) { + // nonmovableAllocator_->Free(mem); + // }); + //} + //PandaMap> count; + //nonmovableAllocator_->Collect([&gcObjectVisitor, &count] (ObjectHeader *obj) { + // auto &e = count[ObjectToRegion(obj)]; + // e.first += 1; + // e.second += GetObjectSize(obj); + // return gcObjectVisitor(obj); + //}); + //for (auto &entry : count) { + // std::cout << "Collect " << entry.second.first << " (" << entry.second.second << ") objects from " << *entry.first << "\n"; + //} + //timespec start, finish; + //clock_gettime(CLOCK_MONOTONIC_RAW, &start); nonmovableAllocator_->Collect(gcObjectVisitor); + //clock_gettime(CLOCK_MONOTONIC_RAW, &finish); + //std::cout << "UDAV: Collect in " << ((finish.tv_sec * 1000000 + finish.tv_nsec / 1000) - (start.tv_sec * 1000000 + start.tv_nsec / 1000)) << "us\n"; nonmovableAllocator_->VisitAndRemoveFreeRegions(regionVisitor); humongousObjectAllocator_->CollectAndRemoveFreeRegions(regionVisitor, gcObjectVisitor); } diff --git a/static_core/runtime/mem/gc/g1/g1-gc.cpp b/static_core/runtime/mem/gc/g1/g1-gc.cpp index f64602fdcb..db72681603 100644 --- a/static_core/runtime/mem/gc/g1/g1-gc.cpp +++ b/static_core/runtime/mem/gc/g1/g1-gc.cpp @@ -2051,7 +2051,10 @@ void G1GC::Remark(const GCTask &task, Marker &marker) auto g1Allocator = this->GetG1ObjectAllocator(); auto allRegions = g1Allocator->GetAllRegions(); for (const auto ®ion : allRegions) { - if (region->HasFlag(IS_OLD) || region->HasFlag(IS_NONMOVABLE)) { + if (region->HasFlag(IS_OLD)) { + region->SwapMarkBitmap(); + } else if (region->HasFlag(IS_NONMOVABLE)) { + region->GetLiveBitmap()->Minus(region->GetMarkBitmap()); region->SwapMarkBitmap(); } } -- Gitee