1/* 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 17function main() { 18 let x1: [int, string] = [1, "a"] 19 let y1: [int, string] = [...x1] 20 assertTrue(y1[0] == 1 && y1[1] == "a") 21 22 let x2: [int, boolean] = [2, true] 23 let y2: [string, int, boolean, int, boolean, string] = ["a", ...x2, ...x2, "b"] 24 assertTrue(y2[0] == "a" && y2[1] == 2 && y2[2] == true) 25 assertTrue(y2[3] == 2 && y2[4] == true && y2[5] == "b") 26 27 let x3: [int, boolean] = [10, false] 28 let x4: [string] = ["e"] 29 let x5: [string, boolean] = ["f", true] 30 let y3: [int, boolean, string, string, int, string, boolean] = [...x3, "g", ...x4, 20, ...x5] 31 assertTrue(y3[0] == 10 && y3[1] == false && y3[2] == "g") 32 assertTrue(y3[3] == "e" && y3[4] == 20 && y3[5] == "f" && y3[6] == true) 33} 34