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'; 26let A = Car; 27 28var myCar = { 29 name: "HWCar_Test", 30 type: "HW_Test", 31 price: "CNY:XXW_Test" 32 } 33 34var infoA = A.carInfo.apply(myCar); 35 36let C = Star; 37 38 var myStar = { 39 name: "Polaris_Test", 40 type: "fixedStar_Test", 41 color: "Yellow_Test" 42 } 43 44var infoC = Star.starColor.apply(myStar); 45 46if (infoA != "HWCar_Test:HW_Test:CNY:XXW_Test" ) { 47 print("Direct Export Fail"); 48} else if (infoC != "Polaris_Test:fixedStar_Test:Yellow_Test") { 49 print("Indirect Export Fail"); 50} else { 51 print("Pass!!"); 52} 53 54class Test { 55 constructor(a) { 56 this.a = a 57 } 58} 59 60var test = new Test(ns.a) 61print(test.a) 62var classTestD = new ClassD() 63print(classTestD.d)