Check options in ecma_op_object_get_own_property for typedarray. (#1627)

And add regression-case subfolder for es2015

Fix issue #1622

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang 2017-03-06 19:07:02 +08:00 committed by GitHub
parent b5a91069fd
commit b13f78f19e
5 changed files with 57 additions and 4 deletions

View File

@ -151,9 +151,17 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
if (ECMA_STRING_GET_CONTAINER (property_name_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC) if (ECMA_STRING_GET_CONTAINER (property_name_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)
{ {
ecma_value_t value = ecma_op_typedarray_get_index_prop (object_p, property_name_p->u.uint32_number); ecma_value_t value = ecma_op_typedarray_get_index_prop (object_p, property_name_p->u.uint32_number);
if (!ecma_is_value_undefined (value)) if (!ecma_is_value_undefined (value))
{ {
property_ref_p->virtual_value = value; if (options & ECMA_PROPERTY_GET_VALUE)
{
property_ref_p->virtual_value = value;
}
else
{
ecma_fast_free_value (value);
}
return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_TYPE_VIRTUAL; return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_TYPE_VIRTUAL;
} }

View File

@ -0,0 +1,22 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* 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.
*/
var a = new Float32Array([0.1, 0.2, 0.3]);
var b = a.hasOwnProperty(1);
var c = a.hasOwnProperty(3);
assert (b === true);
assert (c === false);

View File

@ -0,0 +1,15 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// 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.
for (var a in new Int8Array(123));

View File

@ -81,6 +81,7 @@ jerry_tests_options = [
Options('jerry_tests-debug', ['--debug', '--cpointer-32bit=on', '--mem-heap=1024']), Options('jerry_tests-debug', ['--debug', '--cpointer-32bit=on', '--mem-heap=1024']),
Options('jerry_tests-snapshot', ['--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']), Options('jerry_tests-snapshot', ['--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
Options('jerry_tests-debug-snapshot', ['--debug', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']), Options('jerry_tests-debug-snapshot', ['--debug', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
Options('jerry_tests-es2015-subset-debug', ['--debug', '--profile=es2015-subset'])
] ]
# Test options for jerry-test-suite # Test options for jerry-test-suite
@ -91,7 +92,6 @@ jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug', ['--de
jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug-snapshot', ['--debug', '--profile=minimal', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot'])) jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug-snapshot', ['--debug', '--profile=minimal', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset', ['--profile=es2015-subset'])) jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset', ['--profile=es2015-subset']))
jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset-snapshot', ['--profile=es2015-subset', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot'])) jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset-snapshot', ['--profile=es2015-subset', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset-debug', ['--debug', '--profile=es2015-subset']))
jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset-debug-snapshot', ['--debug', '--profile=es2015-subset', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot'])) jerry_test_suite_options.append(Options('jerry_test_suite-es2015-subset-debug-snapshot', ['--debug', '--profile=es2015-subset', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
# Test options for test262 # Test options for test262
@ -185,8 +185,16 @@ def run_jerry_tests():
break break
test_cmd = [TEST_RUNNER_SCRIPT, get_binary_path(job.out_dir), JERRY_TESTS_DIR] test_cmd = [TEST_RUNNER_SCRIPT, get_binary_path(job.out_dir), JERRY_TESTS_DIR]
skip_list = []
if '--profile=es2015-subset' not in job.build_args:
skip_list.append("es2015\/")
if script_args.skip_list: if script_args.skip_list:
test_cmd.append("--skip-list=" + script_args.skip_list) skip_list.append(script_args.skip_list)
if skip_list:
test_cmd.append("--skip-list=" + ",".join(skip_list))
if job.test_args: if job.test_args:
test_cmd.extend(job.test_args) test_cmd.extend(job.test_args)

View File

@ -74,7 +74,7 @@ fi
# Remove the skipped tests from list # Remove the skipped tests from list
for TEST in "${SKIP_LIST[@]}" for TEST in "${SKIP_LIST[@]}"
do do
( sed -i "/$TEST/d" $TEST_FILES ) ( sed -i -r "/$TEST/d" $TEST_FILES )
done done
TOTAL=$(cat $TEST_FILES | wc -l) TOTAL=$(cat $TEST_FILES | wc -l)