diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/import_unexported_class.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/import_unexported_class.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd3b42ff0e0dfce0248f4cbcacf8547e207f2848 --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/import_unexported_class.ets @@ -0,0 +1,26 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/import_unexported_class +tags: [negative] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import {NotExported as NE} from './to_export' + + function main(): void { + let n = new NE("text12", 12) + } \ No newline at end of file diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/non_linux_path_separators.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/non_linux_path_separators.ets new file mode 100644 index 0000000000000000000000000000000000000000..f823ebaa30f798be8a6c9cf62d21a5ebf8d8aeb6 --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/non_linux_path_separators.ets @@ -0,0 +1,27 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/non_linux_path_separators +tags: [] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import {Origin as O} from '.\to_export' + + function main(): void { + let O1 = new O("text", 2) + console.log(O1) + } \ No newline at end of file diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_func_takes_t_as_param_exported.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_func_takes_t_as_param_exported.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c7b2c1873f6513007be5fda0ef1e27d81240d62 --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_func_takes_t_as_param_exported.ets @@ -0,0 +1,25 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/t_isnt_exported_but_func_takes_t_as_param_exported +tags: [] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import {Foo1 as Foo4} from './to_export' + + function main(): void { + let B = Foo4(new T("test20", 20)) + } \ No newline at end of file diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_func_takes_t_as_return_value_exported.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_func_takes_t_as_return_value_exported.ets new file mode 100644 index 0000000000000000000000000000000000000000..27f6e5933ad9bfd282581a9a7b359f7f1cdb1d85 --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_func_takes_t_as_return_value_exported.ets @@ -0,0 +1,27 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/t_isnt_exported_but_func_takes_t_as_return_value_exported +tags: [] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import {Foo2 as Foo3} from './to_export' + + function main(): void { + let A = Foo3("test23", 23) + console.log(A) + } \ No newline at end of file diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_subtype_of_t_exported.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_subtype_of_t_exported.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b239eb2c79a4df937a5e0b28984c8bfcafab2d0 --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_subtype_of_t_exported.ets @@ -0,0 +1,29 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/t_isnt_exported_but_subtype_of_t_exported +tags: [] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import {S as SS, Foo2 as Foo5} from "./to_export" + + function main(): void { + let B = Foo5(new SS("test7", 7)) + } + + + \ No newline at end of file diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_var_of_t_exported.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_var_of_t_exported.ets new file mode 100644 index 0000000000000000000000000000000000000000..01dfc1a4e9284d2e4215dcb140e6eb075383d72a --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/t_isnt_exported_but_var_of_t_exported.ets @@ -0,0 +1,27 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/t_isnt_exported_but_var_of_t_exported +tags: [] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + import {Origin as O} from './to_export' + + function main(): void { + let O1 = new O("text", 2) + console.log(O1) + } \ No newline at end of file diff --git a/plugins/ets/tests/ets_func_tests/spec/import-export/to_export.ets b/plugins/ets/tests/ets_func_tests/spec/import-export/to_export.ets new file mode 100644 index 0000000000000000000000000000000000000000..27ae3a04b0562bd57578773f1ed0c9566cf3e73c --- /dev/null +++ b/plugins/ets/tests/ets_func_tests/spec/import-export/to_export.ets @@ -0,0 +1,64 @@ +/*--- +desc: 13.04 Default import +name: 13.compilation_units_packages_and_modules/13.04.default_import/to_export +tags: [not-a-test] +---*/ + +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + class T { + field1: string; + field2: number; + + constructor (field1: string, field2: number){ + this.field1 = field1 + this.field2 = field2 + } + + export function Foo1(bar: T): string{ + return T.field1 + } + + export function Foo2(f1: string, f2: number): T { + return new T(f1, f2) + } + + export let Origin = new T("text", 0) + + } + + class NotExported { + fieldNE1: string; + fieldNE2: number; + + constructor (fieldNE1: string, fieldNE2: number){ + this.fieldNE1 = fieldNE1 + this.fieldNE2 = fieldNE2 + } + } + + export class S extends T { + field3: string; + field4: number; + + constructor (field3: string, field4: number){ + this.field3 = field3 + this.field4 = field4 + } + + } + +