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
16function main() {
17    let src: string | undefined = undefined;
18    let s = "_str_";
19    let udef = undefined;
20    let a :string = "A_";
21    let n : string | undefined | null = null;
22
23    let dst: string = "" + src;
24    let dst_s : string = src + "";
25    let a_dst :string = a + dst;
26    let n_dst : string = n + a_dst;
27    let dst_a : string = dst + a;
28    
29    
30
31    assert dst == "undefined";
32    assert dst_s == "undefined";
33    assert a_dst == "A_undefined";
34    assert dst_a == "undefinedA_";
35    assert n_dst == "nullA_undefined";
36    assert udef + s == "undefined_str_";
37    assert s + udef == "_str_undefined";
38    assert a + n == "A_null";
39    assert a + s == "A__str_";
40    assert a + s + udef == "A__str_undefined";
41    assert a + udef + a == "A_undefinedA_";
42    assert udef + s + n == "undefined_str_null";
43
44    let p1 = 1
45    let p2 = 2
46    let p3 = "*"
47
48    let res = p1+p2+p3;
49    assert (res == "3*")
50}
51