14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_ci/*
174514f5e3Sopenharmony_ci * @tc.name:objoperate
184514f5e3Sopenharmony_ci * @tc.desc:test object hasOwnProperty
194514f5e3Sopenharmony_ci * @tc.type: FUNC
204514f5e3Sopenharmony_ci * @tc.require: issueI5NO8G
214514f5e3Sopenharmony_ci */
224514f5e3Sopenharmony_civar str = "wodehaoxiongditiantiandouxuyao";
234514f5e3Sopenharmony_civar str1 = "wodehaoxiongdi";
244514f5e3Sopenharmony_civar str2 = "回家好好slsa";
254514f5e3Sopenharmony_civar str3 = "jiarenmeng";
264514f5e3Sopenharmony_civar str4 = str1 + str2;
274514f5e3Sopenharmony_civar str5 = str1 + str3;
284514f5e3Sopenharmony_cifunction fn() {
294514f5e3Sopenharmony_ci    this.大家 = "hao";
304514f5e3Sopenharmony_ci    this[str1] = "hao1";
314514f5e3Sopenharmony_ci    this[str2] = "hao2";
324514f5e3Sopenharmony_ci    this[str4] = "hao3";
334514f5e3Sopenharmony_ci    this[str5] = "hao4";
344514f5e3Sopenharmony_ci}
354514f5e3Sopenharmony_ci
364514f5e3Sopenharmony_civar obj = new fn();
374514f5e3Sopenharmony_civar str6 = str.substring(0, 20);
384514f5e3Sopenharmony_ciobj[str6] = "hao5";
394514f5e3Sopenharmony_ciprint(obj.hasOwnProperty("大家"));
404514f5e3Sopenharmony_ciprint(obj.hasOwnProperty("wodehaoxiongdi"));
414514f5e3Sopenharmony_ciprint(obj.hasOwnProperty("回家好好slsa"));
424514f5e3Sopenharmony_ciprint(obj.hasOwnProperty("wodehaoxiongdi回家好好slsa"));
434514f5e3Sopenharmony_ciprint(obj.hasOwnProperty("wodehaoxiongdijiarenmeng"));
444514f5e3Sopenharmony_ciprint(obj.hasOwnProperty("wodehaoxiongditianti"));
454514f5e3Sopenharmony_ci
464514f5e3Sopenharmony_civar arr = new Array(4);
474514f5e3Sopenharmony_ciarr[0] = 3;
484514f5e3Sopenharmony_ciprint(arr.hasOwnProperty("0"));
494514f5e3Sopenharmony_ciprint(arr.hasOwnProperty("1"));
504514f5e3Sopenharmony_ciprint(arr.hasOwnProperty("wodehaoxiongdi"));
514514f5e3Sopenharmony_ci
524514f5e3Sopenharmony_ciObject.defineProperty(Array.prototype, "new1", {
534514f5e3Sopenharmony_ci    value:37,
544514f5e3Sopenharmony_ci    writable:false,
554514f5e3Sopenharmony_ci});
564514f5e3Sopenharmony_ci
574514f5e3Sopenharmony_civar arr1 = new Array(4);
584514f5e3Sopenharmony_ciprint(arr1.new1);
594514f5e3Sopenharmony_ciprint(arr1.hasOwnProperty("0"));
604514f5e3Sopenharmony_ciprint(arr1.hasOwnProperty("new1"));
614514f5e3Sopenharmony_ci
624514f5e3Sopenharmony_civar k = 5;
634514f5e3Sopenharmony_ciprint(str5.hasOwnProperty("t"));
644514f5e3Sopenharmony_ciprint(str5.hasOwnProperty("wode"));
654514f5e3Sopenharmony_ciprint(k.hasOwnProperty("t"));
664514f5e3Sopenharmony_ci
674514f5e3Sopenharmony_civar person = {name: "hhh"};
684514f5e3Sopenharmony_civar proxy = new Proxy(person, {
694514f5e3Sopenharmony_ci    get: function(target, property) {
704514f5e3Sopenharmony_ci        if (property in target) {
714514f5e3Sopenharmony_ci            return target[property];
724514f5e3Sopenharmony_ci        } else {
734514f5e3Sopenharmony_ci            return "cuowu";
744514f5e3Sopenharmony_ci        }
754514f5e3Sopenharmony_ci    }
764514f5e3Sopenharmony_ci});
774514f5e3Sopenharmony_ciprint(proxy.name);
784514f5e3Sopenharmony_ciprint(proxy.age);
794514f5e3Sopenharmony_ciprint(proxy.hasOwnProperty('name'));
804514f5e3Sopenharmony_ciprint(proxy.hasOwnProperty('age'));
814514f5e3Sopenharmony_ci
824514f5e3Sopenharmony_cilet obj2 = {};
834514f5e3Sopenharmony_ciobj2.property1 = 12;
844514f5e3Sopenharmony_ci// is not intern string branch and not found in intern string table
854514f5e3Sopenharmony_ciprint(obj2.hasOwnProperty(String.fromCodePoint("")));
864514f5e3Sopenharmony_ci// is not intern string branch and found in intern string table
874514f5e3Sopenharmony_ciprint(obj2.hasOwnProperty(String.fromCodePoint(123)));