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

Side by Side Diff: runtime/platform/assert.h

Issue 243973002: - Add a minimal implementation of Capability. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | runtime/vm/bootstrap_natives.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #ifndef PLATFORM_ASSERT_H_ 5 #ifndef PLATFORM_ASSERT_H_
6 #define PLATFORM_ASSERT_H_ 6 #define PLATFORM_ASSERT_H_
7 7
8 // TODO(5411406): include sstream for now, once we have a Utils::toString() 8 // TODO(5411406): include sstream for now, once we have a Utils::toString()
9 // implemented for all the primitive types we can replace the usage of 9 // implemented for all the primitive types we can replace the usage of
10 // sstream by Utils::toString() 10 // sstream by Utils::toString()
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 139
140 template<typename E, typename A> 140 template<typename E, typename A>
141 void DynamicAssertionHelper::StringEquals(const E& expected, const A& actual) { 141 void DynamicAssertionHelper::StringEquals(const E& expected, const A& actual) {
142 std::ostringstream ess, ass; 142 std::ostringstream ess, ass;
143 ess << expected; 143 ess << expected;
144 ass << actual; 144 ass << actual;
145 std::string es = ess.str(), as = ass.str(); 145 std::string es = ess.str(), as = ass.str();
146 if (as == es) return; 146 if (as == es) return;
147 Fail("expected: <\"%s\"> but was: <\"%s\">", es.c_str(), as.c_str()); 147 Fail("expected:\n<\"%s\">\nbut was:\n<\"%s\">", es.c_str(), as.c_str());
148 } 148 }
149 149
150 150
151 template<typename E, typename A> 151 template<typename E, typename A>
152 void DynamicAssertionHelper::IsSubstring(const E& needle, const A& haystack) { 152 void DynamicAssertionHelper::IsSubstring(const E& needle, const A& haystack) {
153 std::ostringstream ess, ass; 153 std::ostringstream ess, ass;
154 ess << needle; 154 ess << needle;
155 ass << haystack; 155 ass << haystack;
156 std::string es = ess.str(), as = ass.str(); 156 std::string es = ess.str(), as = ass.str();
157 if (as.find(es) != std::string::npos) return; 157 if (as.find(es) != std::string::npos) return;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 #define FAIL1(format, p1) \ 345 #define FAIL1(format, p1) \
346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) 346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1))
347 347
348 #define FAIL2(format, p1, p2) \ 348 #define FAIL2(format, p1, p2) \
349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) 349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2))
350 350
351 #endif // defined(TESTING) 351 #endif // defined(TESTING)
352 352
353 #endif // PLATFORM_ASSERT_H_ 353 #endif // PLATFORM_ASSERT_H_
OLDNEW
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698