b4c9e2e716
- Update most callsites to use the new RunJS method - Update tests to use TestWithNativeContext if possible - Remove RunJS from test-helpers.cc - Remove TestWithRandomNumberGenerator from test-utils.h Change-Id: Ib2a6cc56334dc391ca6a2aeb7780fa324f44f109 Reviewed-on: https://chromium-review.googlesource.com/765373 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#49325}
38 lines
1005 B
C++
38 lines
1005 B
C++
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "src/api.h"
|
|
#include "src/objects-inl.h"
|
|
#include "test/unittests/test-helpers.h"
|
|
#include "test/unittests/test-utils.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
class PreParserTest : public TestWithNativeContext {
|
|
public:
|
|
PreParserTest() {}
|
|
|
|
private:
|
|
DISALLOW_COPY_AND_ASSIGN(PreParserTest);
|
|
};
|
|
|
|
TEST_F(PreParserTest, LazyFunctionLength) {
|
|
const char* script_source = "function lazy(a, b, c) { } lazy";
|
|
|
|
Handle<JSFunction> lazy_function = RunJS<JSFunction>(script_source);
|
|
|
|
Handle<SharedFunctionInfo> shared(lazy_function->shared());
|
|
CHECK_EQ(shared->length(), SharedFunctionInfo::kInvalidLength);
|
|
|
|
Handle<Smi> length = RunJS<Smi>("lazy.length");
|
|
int32_t value;
|
|
CHECK(length->ToInt32(&value));
|
|
CHECK_EQ(3, value);
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|