LCOV - code coverage report
Current view: top level - test/unittests/parser - preparser-unittest.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 11 11 100.0 %
Date: 2017-10-20 Functions: 8 10 80.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.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           1 : class PreParserTest : public TestWithContext {
      15             :  public:
      16           1 :   PreParserTest() {}
      17             : 
      18             :  private:
      19             :   DISALLOW_COPY_AND_ASSIGN(PreParserTest);
      20             : };
      21             : 
      22       13159 : TEST_F(PreParserTest, LazyFunctionLength) {
      23             :   const char* script_source = "function lazy(a, b, c) { } lazy";
      24             : 
      25           1 :   Handle<Object> lazy_object = test::RunJS(isolate(), script_source);
      26             : 
      27             :   Handle<SharedFunctionInfo> shared(
      28             :       Handle<JSFunction>::cast(lazy_object)->shared(), i_isolate());
      29           1 :   CHECK_EQ(shared->length(), SharedFunctionInfo::kInvalidLength);
      30             : 
      31             :   const char* get_length_source = "lazy.length";
      32             : 
      33           1 :   Handle<Object> length = test::RunJS(isolate(), get_length_source);
      34           1 :   CHECK(length->IsSmi());
      35             :   int32_t value;
      36           1 :   CHECK(length->ToInt32(&value));
      37           1 :   CHECK_EQ(3, value);
      38           1 : }
      39             : 
      40             : }  // namespace internal
      41        7893 : }  // namespace v8

Generated by: LCOV version 1.10