1/* 2 * Copyright (c) 2023-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 16let flag = false 17 18function set_flag(): String { 19 flag = true 20 return "Paragliding is awesome!!\n" 21} 22 23export function main(): int { 24 let p = launch set_flag(); 25 let result = p.awaitResolution(); 26 27 if (!flag) { 28 console.print("Flag is not set!"); 29 return 1; 30 } else { 31 console.print("First await result: " + result); 32 let result2 = p.awaitResolution(); 33 console.print("Second await result: " + result2); 34 if (!(result === result2)) { 35 console.print("Await results do not match!"); 36 return 1; 37 } 38 if (!(result instanceof String)) { 39 console.print("Await result is not String!"); 40 return 1; 41 } 42 } 43 return 0; 44} 45