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

Unified Diff: runtime/vm/object_test.cc

Issue 196653004: - Fix formatting of generated sources. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 33569)
+++ runtime/vm/object_test.cc (working copy)
@@ -185,6 +185,40 @@
}
+TEST_CASE(GenerateExactSource) {
+ // Verify the exact formatting of generated sources.
+ const char* kScriptChars =
+ "\n"
+ "class A {\n"
+ " static bar() { return 42; }\n"
+ " static fly() { return 5; }\n"
+ " void catcher(x) {\n"
+ " try {\n"
+ " if (x) {\n"
+ " fly();\n"
+ " } else {\n"
+ " !fly();\n"
+ " }\n"
+ " } on Blah catch (a) {\n"
+ " _print(17);\n"
+ " } catch (e, s) {\n"
kasperl 2014/03/12 09:20:17 Also test that it works with finally? There was a
+ " bar()\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ String& url = String::Handle(String::New("dart-test:GenerateExactSource"));
+ String& source = String::Handle(String::New(kScriptChars));
+ Script& script = Script::Handle(Script::New(url,
+ source,
+ RawScript::kScriptTag));
+ script.Tokenize(String::Handle(String::New("")));
+ const TokenStream& tokens = TokenStream::Handle(script.tokens());
+ const String& gen_source = String::Handle(tokens.GenerateSource());
+ EXPECT_STREQ(source.ToCString(), gen_source.ToCString());
+}
+
+
TEST_CASE(InstanceClass) {
// Allocate the class first.
String& class_name = String::Handle(Symbols::New("EmptyClass"));
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698