1/* 2 * Copyright (c) 2024 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/* 17 * @tc.name:sharedarray 18 * @tc.desc:test sharedarray 19 * @tc.type: FUNC 20 * @tc.require: issueI8QUU0 21 */ 22 23// @ts-nocheck 24declare function print(str: any): string; 25declare function isSendable(obj: lang.ISendable | Object): boolean; 26 27class SendableClass { 28 constructor() { 29 "use sendable" 30 } 31} 32 33class UnSendableClass { 34 constructor() { 35 "not sendable" 36 } 37} 38 39sendCs = new SendableClass(); 40if (isSendable(sendCs)) { 41 print("Sendable class is sendable"); 42} else { 43 print("Sendable class is not sendable"); 44} 45 46noSendCs = new UnSendableClass(); 47if (isSendable(noSendCs)) { 48 print("UnSendable class is sendable"); 49} else { 50 print("UnSendable class is not sendable"); 51} 52 53let bool = true; 54if (isSendable(bool)) { 55 print("boolean is sendable"); 56} else { 57 print("boolean is not sendable"); 58} 59 60 61let str = "hello world"; 62if (isSendable(str)) { 63 print("string is sendable"); 64} else { 65 print("string is not sendable"); 66} 67 68let num = 0; 69if (isSendable(num)) { 70 print("number is sendable"); 71} else { 72 print("number is not sendable"); 73} 74 75let bigInt = 124567890123456789012345678901234567890n; 76if (isSendable(bigInt)) { 77 print("bigInt is sendable"); 78} else { 79 print("bigInt is not sendable"); 80} 81 82function func() 83{} 84if (isSendable(func)) { 85 print("function is sendable"); 86} else { 87 print("function is not sendable"); 88} 89 90function sendableFunc() 91{ 92 "use sendable" 93} 94if (isSendable(func)) { 95 print("sendableFunc is sendable"); 96} else { 97 print("sendableFunc is not sendable"); 98} 99 100