• 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
16'use static'
17import { foo, person, TestHelper, Machine, User, Person, Employee } from "./interop_not_have_property_js"
18
19foo.name
20foo.name = "456"
21person.age = 23
22person.male = [2, 3]
23foo.age = 12
24if (foo.name = "456") { print("true") }
25
26let a = new foo()
27a.age = 12
28
29let test_helper = new TestHelper("TEST_INSTANTIATE_JS_OBJECT");
30test_helper.test(() => {
31    let machine = new Machine();
32    return machine.name === "machine"; // arkts-interop-js2s-access-js-prop
33}, "machine.name === 'machine'");
34
35test_helper.test(() => {
36    let user = new User("Bob");
37    return user.id === "Bob"; // arkts-interop-js2s-access-js-prop
38}, "user.id === 'Bob'");
39
40test_helper.test(() => {
41let user = new User(10);
42return user.id === 10;// arkts-interop-js2s-access-js-prop
43}, "user.id === 10");
44
45test_helper.test(() => {
46    let user = new User(123n);
47    return user.id === 123n; // arkts-interop-js2s-access-js-prop
48}, "user.id === 123n");
49
50test_helper.test(() => {
51    let user = new User(true);
52    return user.id === true;// arkts-interop-js2s-access-js-prop
53}, "user.id === true");
54
55test_helper.test(() => {
56    let machine = new Person("John", 10);
57    return machine.name === "machine"; // arkts-interop-js2s-access-js-prop
58}, "machine.name === 'machine'");
59
60test_helper.test(() => {
61    let employee = new Employee();
62    return employee.name === "employee"; // arkts-interop-js2s-access-js-prop
63}, "employee.name === 'employee'");