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 27@Sendable 28class SendableClass { 29 constructor() { 30 "is sendable" 31 } 32} 33 34class UnSendableClass { 35 constructor() { 36 "not sendable" 37 } 38} 39 40sendCs = new SendableClass(); 41if (isSendable(sendCs)) { 42 print("Sendable class is sendable"); 43} else { 44 print("Sendable class is not sendable"); 45} 46 47noSendCs = new UnSendableClass(); 48if (isSendable(noSendCs)) { 49 print("UnSendable class is sendable"); 50} else { 51 print("UnSendable class is not sendable"); 52} 53 54let bool = true; 55if (isSendable(bool)) { 56 print("boolean is sendable"); 57} else { 58 print("boolean is not sendable"); 59} 60 61 62let str = "hello world"; 63if (isSendable(str)) { 64 print("string is sendable"); 65} else { 66 print("string is not sendable"); 67} 68 69let num = 0; 70if (isSendable(num)) { 71 print("number is sendable"); 72} else { 73 print("number is not sendable"); 74} 75 76let bigInt = 124567890123456789012345678901234567890n; 77if (isSendable(bigInt)) { 78 print("bigInt is sendable"); 79} else { 80 print("bigInt is not sendable"); 81} 82 83function func() 84{} 85if (isSendable(func)) { 86 print("function is sendable"); 87} else { 88 print("function is not sendable"); 89} 90 91