OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <fstream> | 5 #include <fstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-array-iterator.h" | 10 #include "src/interpreter/bytecode-array-iterator.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 std::string BuildActual(const BytecodeExpectationsPrinter& printer, | 101 std::string BuildActual(const BytecodeExpectationsPrinter& printer, |
102 const char* (&snippet_list)[N], | 102 const char* (&snippet_list)[N], |
103 const char* prologue = nullptr, | 103 const char* prologue = nullptr, |
104 const char* epilogue = nullptr) { | 104 const char* epilogue = nullptr) { |
105 std::ostringstream actual_stream; | 105 std::ostringstream actual_stream; |
106 for (const char* snippet : snippet_list) { | 106 for (const char* snippet : snippet_list) { |
107 std::string source_code; | 107 std::string source_code; |
108 if (prologue) source_code += prologue; | 108 if (prologue) source_code += prologue; |
109 source_code += snippet; | 109 source_code += snippet; |
110 if (epilogue) source_code += epilogue; | 110 if (epilogue) source_code += epilogue; |
111 if (source_code.size() > 0 && source_code.back() != '\n') { | |
112 source_code += '\n'; | |
rmcilroy
2016/05/09 15:36:52
Does this get hit in the current code? Is there a
| |
113 } | |
111 printer.PrintExpectation(actual_stream, source_code); | 114 printer.PrintExpectation(actual_stream, source_code); |
112 } | 115 } |
113 return actual_stream.str(); | 116 return actual_stream.str(); |
114 } | 117 } |
115 | 118 |
116 using ConstantPoolType = BytecodeExpectationsPrinter::ConstantPoolType; | 119 using ConstantPoolType = BytecodeExpectationsPrinter::ConstantPoolType; |
117 | 120 |
118 TEST(PrimitiveReturnStatements) { | 121 TEST(PrimitiveReturnStatements) { |
119 InitializedIgnitionHandleScope scope; | 122 InitializedIgnitionHandleScope scope; |
120 BytecodeExpectationsPrinter printer(CcTest::isolate(), | 123 BytecodeExpectationsPrinter printer(CcTest::isolate(), |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2168 }; | 2171 }; |
2169 | 2172 |
2170 CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Generators.golden")); | 2173 CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Generators.golden")); |
2171 | 2174 |
2172 FLAG_ignition_generators = old_flag; | 2175 FLAG_ignition_generators = old_flag; |
2173 } | 2176 } |
2174 | 2177 |
2175 } // namespace interpreter | 2178 } // namespace interpreter |
2176 } // namespace internal | 2179 } // namespace internal |
2177 } // namespace v8 | 2180 } // namespace v8 |
OLD | NEW |