| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/dart_api_impl.h" | 5 #include "vm/dart_api_impl.h" |
| 6 #include "vm/debugger.h" | 6 #include "vm/debugger.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| 11 // Search for the formatted string in buffer. | 11 // Search for the formatted string in buffer. |
| 12 // | 12 // |
| 13 // TODO(turnidge): This function obscures the line number of failing | 13 // TODO(turnidge): This function obscures the line number of failing |
| 14 // EXPECTs. Rework this. | 14 // EXPECTs. Rework this. |
| 15 static void ExpectSubstringF(const char* buff, const char* fmt, ...) { | 15 static void ExpectSubstringF(const char* buff, const char* fmt, ...) { |
| 16 Isolate* isolate = Isolate::Current(); | |
| 17 | |
| 18 va_list args; | 16 va_list args; |
| 19 va_start(args, fmt); | 17 va_start(args, fmt); |
| 20 intptr_t len = OS::VSNPrint(NULL, 0, fmt, args); | 18 intptr_t len = OS::VSNPrint(NULL, 0, fmt, args); |
| 21 va_end(args); | 19 va_end(args); |
| 22 | 20 |
| 23 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); | 21 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1); |
| 24 va_list args2; | 22 va_list args2; |
| 25 va_start(args2, fmt); | 23 va_start(args2, fmt); |
| 26 OS::VSNPrint(buffer, (len + 1), fmt, args2); | 24 OS::VSNPrint(buffer, (len + 1), fmt, args2); |
| 27 va_end(args2); | 25 va_end(args2); |
| 28 | 26 |
| 29 EXPECT_SUBSTRING(buffer, buff); | 27 EXPECT_SUBSTRING(buffer, buff); |
| 30 } | 28 } |
| 31 | 29 |
| 32 | 30 |
| 33 TEST_CASE(Debugger_PrintBreakpointsToJSONArray) { | 31 TEST_CASE(Debugger_PrintBreakpointsToJSONArray) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 debugger->SetBreakpointAtLine(url, 2); | 129 debugger->SetBreakpointAtLine(url, 2); |
| 132 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 130 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 133 EXPECT_VALID(result); | 131 EXPECT_VALID(result); |
| 134 EXPECT(Dart_IsString(result)); | 132 EXPECT(Dart_IsString(result)); |
| 135 | 133 |
| 136 // We ran the code in InspectPausedEvent. | 134 // We ran the code in InspectPausedEvent. |
| 137 EXPECT(saw_paused_event); | 135 EXPECT(saw_paused_event); |
| 138 } | 136 } |
| 139 | 137 |
| 140 } // namespace dart | 138 } // namespace dart |
| OLD | NEW |