1/* 2 * Copyright (c) 2022 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 16exports.source = ` 17import { router1, router2 } from "@system.router"; 18import { app } from "@system.router"; 19import { fetch } from "@system.fetch"; 20 21import { router1, router2, router3 } = require('@system.router'); 22import { app1, app2 } = require('@system.app'); 23import { fetch } = require('@system.fetch'); 24 25import router from "@system.router" 26import app from "@system.router" 27import fetch from "@system.fetch" 28 29import router = require('@system.router') 30import app = require('@system.app') 31import fetch = require('@system.fetch') 32 33import fetch from '@ohos.net.http' 34 35import hello from 'libhello.so' 36import world = require('libworld.so')` 37 38exports.expectResult = 39`"use strict"; 40let __generate__Id = 0; 41function generateId() { 42 return "importSystemApi_" + ++__generate__Id; 43} 44var { router1, router2 } = globalThis.requireNativeModule('system.router'); 45var { app } = globalThis.requireNativeModule('system.router'); 46var { fetch } = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); 47var { router1, router2, router3 } = globalThis.requireNativeModule('system.router'); 48var { app1, app2 } = globalThis.requireNativeModule('system.app'); 49var { fetch } = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); 50var router = globalThis.requireNativeModule('system.router'); 51var app = globalThis.requireNativeModule('system.router'); 52var fetch = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); 53var router = globalThis.requireNativeModule('system.router'); 54var app = globalThis.requireNativeModule('system.app'); 55var fetch = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); 56var fetch = globalThis.requireNapi('net.http') || (isSystemplugin('net.http', 'ohos') ? globalThis.ohosplugin.net.http : isSystemplugin('net.http', 'system') ? globalThis.systemplugin.net.http : undefined); 57var hello = globalThis.requireNapi("hello", true); 58var world = globalThis.requireNapi("world", true); 59` 60