• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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:module
18 * @tc.desc:test module
19 * @tc.type: FUNC
20 * @tc.require: issueI5NO8G
21 */
22import { Car } from './B.js';   // Test direct Export & use after import
23import { Star } from './C.js';  // Test indirect Export & use after import
24import * as ns from './A.js';
25import { D as ClassD} from './D.js';
26import {tmp, f} from './exportas.js'
27let A = Car;
28
29var myCar = {
30     name: "HWCar_Test",
31     type: "HW_Test",
32     price: "CNY:XXW_Test"
33 }
34
35var infoA = A.carInfo.apply(myCar);
36
37let C = Star;
38
39 var myStar = {
40     name: "Polaris_Test",
41     type: "fixedStar_Test",
42     color: "Yellow_Test"
43 }
44
45var infoC = Star.starColor.apply(myStar);
46
47if (infoA != "HWCar_Test:HW_Test:CNY:XXW_Test" ) {
48    print("Direct Export Fail");
49} else if (infoC != "Polaris_Test:fixedStar_Test:Yellow_Test") {
50    print("Indirect Export Fail");
51} else {
52    print("Pass!!");
53}
54
55class Test {
56    constructor(a) {
57        this.a = a
58    }
59}
60
61var test = new Test(ns.a)
62print(test.a)
63var classTestD = new ClassD()
64print(classTestD.d)
65print("export as ... case test : " + tmp);
66f();