LCOV - code coverage report
Current view: top level - test/unittests/parser - preparser-unittest.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 8 8 100.0 %
Date: 2019-04-17 Functions: 5 5 100.0 %

          Line data    Source code
       1             : // Copyright 2017 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/api-inl.h"
       6             : #include "src/objects-inl.h"
       7             : #include "test/unittests/test-helpers.h"
       8             : #include "test/unittests/test-utils.h"
       9             : #include "testing/gtest/include/gtest/gtest.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14           2 : class PreParserTest : public TestWithNativeContext {
      15             :  public:
      16           1 :   PreParserTest() = default;
      17             : 
      18             :  private:
      19             :   DISALLOW_COPY_AND_ASSIGN(PreParserTest);
      20             : };
      21             : 
      22       15445 : TEST_F(PreParserTest, LazyFunctionLength) {
      23             :   const char* script_source = "function lazy(a, b, c) { } lazy";
      24             : 
      25             :   Handle<JSFunction> lazy_function = RunJS<JSFunction>(script_source);
      26             : 
      27             :   Handle<SharedFunctionInfo> shared(lazy_function->shared(),
      28             :                                     lazy_function->GetIsolate());
      29           1 :   CHECK_EQ(3, shared->length());
      30             : 
      31             :   Handle<Smi> length = RunJS<Smi>("lazy.length");
      32             :   int32_t value;
      33           1 :   CHECK(length->ToInt32(&value));
      34           1 :   CHECK_EQ(3, value);
      35           1 : }
      36             : 
      37             : }  // namespace internal
      38        9264 : }  // namespace v8

Generated by: LCOV version 1.10