Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: runtime/vm/log_test.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/log.cc ('k') | runtime/vm/longjump.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_tools_api.h" 7 #include "include/dart_tools_api.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 static void FreeTestOutput() { 49 static void FreeTestOutput() {
50 if (test_output_ != NULL) { 50 if (test_output_ != NULL) {
51 free(const_cast<char*>(test_output_)); 51 free(const_cast<char*>(test_output_));
52 test_output_ = NULL; 52 test_output_ = NULL;
53 } 53 }
54 } 54 }
55 }; 55 };
56 56
57
58 TEST_CASE(Log_Macro) { 57 TEST_CASE(Log_Macro) {
59 test_output_ = NULL; 58 test_output_ = NULL;
60 Log* log = Log::Current(); 59 Log* log = Log::Current();
61 LogTestHelper::SetPrinter(log, TestPrinter); 60 LogTestHelper::SetPrinter(log, TestPrinter);
62 61
63 THR_Print("Hello %s", "World"); 62 THR_Print("Hello %s", "World");
64 EXPECT_STREQ("Hello World", test_output_); 63 EXPECT_STREQ("Hello World", test_output_);
65 THR_Print("SingleArgument"); 64 THR_Print("SingleArgument");
66 EXPECT_STREQ("SingleArgument", test_output_); 65 EXPECT_STREQ("SingleArgument", test_output_);
67 LogTestHelper::FreeTestOutput(); 66 LogTestHelper::FreeTestOutput();
68 } 67 }
69 68
70
71 TEST_CASE(Log_Basic) { 69 TEST_CASE(Log_Basic) {
72 test_output_ = NULL; 70 test_output_ = NULL;
73 Log* log = new Log(TestPrinter); 71 Log* log = new Log(TestPrinter);
74 72
75 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 73 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
76 log->Print("Hello %s", "World"); 74 log->Print("Hello %s", "World");
77 EXPECT_STREQ("Hello World", test_output_); 75 EXPECT_STREQ("Hello World", test_output_);
78 76
79 delete log; 77 delete log;
80 LogTestHelper::FreeTestOutput(); 78 LogTestHelper::FreeTestOutput();
81 } 79 }
82 80
83
84 TEST_CASE(Log_Block) { 81 TEST_CASE(Log_Block) {
85 test_output_ = NULL; 82 test_output_ = NULL;
86 Log* log = new Log(TestPrinter); 83 Log* log = new Log(TestPrinter);
87 84
88 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 85 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
89 { 86 {
90 LogBlock ba(thread, log); 87 LogBlock ba(thread, log);
91 log->Print("APPLE"); 88 log->Print("APPLE");
92 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 89 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
93 { 90 {
94 LogBlock ba(thread, log); 91 LogBlock ba(thread, log);
95 log->Print("BANANA"); 92 log->Print("BANANA");
96 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 93 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
97 } 94 }
98 EXPECT_STREQ("BANANA", test_output_); 95 EXPECT_STREQ("BANANA", test_output_);
99 } 96 }
100 EXPECT_STREQ("APPLE", test_output_); 97 EXPECT_STREQ("APPLE", test_output_);
101 delete log; 98 delete log;
102 LogTestHelper::FreeTestOutput(); 99 LogTestHelper::FreeTestOutput();
103 } 100 }
104 101
105 } // namespace dart 102 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/log.cc ('k') | runtime/vm/longjump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698