• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 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
16function main(){
17    let x  = `This is an example of a multiline string,
18                    which should be enclosed in
19                    backticks`;
20    type UT = `This is an example of a multiline string,
21                    which should be enclosed in
22                    backticks` | "X";
23    let x2:UT = `This is an example of a multiline string,
24                    which should be enclosed in
25                    backticks`
26    assertEQ(x, x2)
27    assertEQ(x2, `This is an example of a multiline string,
28                    which should be enclosed in
29                    backticks`)
30    assertEQ(x2, "This is an example of a multiline string,\n                    which should be enclosed in\n                    backticks")
31
32    let x3  = `This is an example of a multiline string`;
33    type UT2 = `This is an example of a multiline string` | "X";
34    let x4:UT2 = `This is an example of a multiline string`
35    assertEQ(x3, x4)
36    assertEQ(x4, `This is an example of a multiline string`)
37    assertEQ(x4, "This is an example of a multiline string")
38
39    let a = 10
40    let b = 20
41    let x5  = `The result of ${a} * ${b} is ${a * b}`;
42    type UT3 = `The result of ${a} * ${b} is ${a * b}` | "X";
43    let x6:UT3 = `The result of ${a} * ${b} is ${a * b}`
44    assertEQ(x5, x6)
45    assertEQ(x6, `The result of ${a} * ${b} is ${a * b}`)
46    assertEQ(x6, "The result of " + a + " * " + b + " is " + a * b)
47
48
49    let x7: [number, string, Int] = [2,  `This is an example of a multiline string,
50                    which should be enclosed in
51                    backticks`, 3];
52    assertEQ(x7[1], "This is an example of a multiline string,\n                    which should be enclosed in\n                    backticks")
53}
54