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

Side by Side Diff: pkg/intl/test/message_extraction/sample_with_messages.dart

Issue 23484010: Re-arrange tests to allow testing generated messages code in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Regenerated code Created 7 years, 3 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
OLDNEW
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 /** 5 /**
6 * This is a program with various [Intl.message] messages. It just prints 6 * This is a program with various [Intl.message] messages. It just prints
7 * all of them, and is used for testing of message extraction, translation, 7 * all of them, and is used for testing of message extraction, translation,
8 * and code generation. 8 * and code generation.
9 */ 9 */
10 library sample; 10 library sample;
11 11
12 import "package:intl/intl.dart"; 12 import "package:intl/intl.dart";
13 import "foo_messages_all.dart"; 13 import "foo_messages_all.dart";
14 import "print_to_list.dart";
15 import "dart:async";
14 16
15 part 'part_of_sample_with_messages.dart'; 17 part 'part_of_sample_with_messages.dart';
16 18
17 message1() => Intl.message("This is a message", name: 'message1', desc: 'foo' ); 19 message1() => Intl.message("This is a message", name: 'message1', desc: 'foo' );
18 20
19 message2(x) => Intl.message("Another message with parameter $x", 21 message2(x) => Intl.message("Another message with parameter $x",
20 name: 'message2', desc: 'Description 2', args: [x]); 22 name: 'message2', desc: 'Description 2', args: [x]);
21 23
22 // A string with multiple adjacent strings concatenated together, verify 24 // A string with multiple adjacent strings concatenated together, verify
23 // that the parser handles this properly. 25 // that the parser handles this properly.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // A function that is assigned to a variable. It's also nested 120 // A function that is assigned to a variable. It's also nested
119 // within another function definition. 121 // within another function definition.
120 message3(a, b, c) => Intl.message( 122 message3(a, b, c) => Intl.message(
121 "Characters that need escaping, e.g slashes \\ dollars \${ (curly braces " 123 "Characters that need escaping, e.g slashes \\ dollars \${ (curly braces "
122 "are ok) and xml reserved characters <& and quotes \" " 124 "are ok) and xml reserved characters <& and quotes \" "
123 "parameters $a, $b, and $c", 125 "parameters $a, $b, and $c",
124 name: 'message3', 126 name: 'message3',
125 args: [a, b, c]); 127 args: [a, b, c]);
126 var messageVariable = message3; 128 var messageVariable = message3;
127 129
128 print("-------------------------------------------"); 130 printOut("-------------------------------------------");
129 print("Printing messages for ${locale.locale}"); 131 printOut("Printing messages for ${locale.locale}");
130 Intl.withLocale(locale.locale, () { 132 Intl.withLocale(locale.locale, () {
131 print(message1()); 133 printOut(message1());
132 print(message2("hello")); 134 printOut(message2("hello"));
133 print(messageVariable(1,2,3)); 135 printOut(messageVariable(1,2,3));
134 print(multiLine()); 136 printOut(multiLine());
135 print(types(1, "b", ["c", "d"])); 137 printOut(types(1, "b", ["c", "d"]));
136 print(leadingQuotes()); 138 printOut(leadingQuotes());
137 print(alwaysTranslated()); 139 printOut(alwaysTranslated());
138 print(trickyInterpolation("this")); 140 printOut(trickyInterpolation("this"));
139 var thing = new YouveGotMessages(); 141 var thing = new YouveGotMessages();
140 print(thing.method()); 142 printOut(thing.method());
141 print(thing.nonLambda()); 143 printOut(thing.nonLambda());
142 var x = YouveGotMessages.staticMessage(); 144 var x = YouveGotMessages.staticMessage();
143 print(YouveGotMessages.staticMessage()); 145 printOut(YouveGotMessages.staticMessage());
144 print(notAlwaysTranslated()); 146 printOut(notAlwaysTranslated());
145 print(originalNotInBMP()); 147 printOut(originalNotInBMP());
146 print(escapable()); 148 printOut(escapable());
147 149
148 print(thing.plurals(0)); 150 printOut(thing.plurals(0));
149 print(thing.plurals(1)); 151 printOut(thing.plurals(1));
150 print(thing.plurals(2)); 152 printOut(thing.plurals(2));
151 var alice = new Person("Alice", "female"); 153 var alice = new Person("Alice", "female");
152 var bob = new Person("Bob", "male"); 154 var bob = new Person("Bob", "male");
153 var cat = new Person("cat", null); 155 var cat = new Person("cat", null);
154 print(thing.whereTheyWent(alice, "house")); 156 printOut(thing.whereTheyWent(alice, "house"));
155 print(thing.whereTheyWent(bob, "house")); 157 printOut(thing.whereTheyWent(bob, "house"));
156 print(thing.whereTheyWent(cat, "litter box")); 158 printOut(thing.whereTheyWent(cat, "litter box"));
157 print(thing.nested([alice, bob], "magasin")); 159 printOut(thing.nested([alice, bob], "magasin"));
158 print(thing.nested([alice], "magasin")); 160 printOut(thing.nested([alice], "magasin"));
159 print(thing.nested([], "magasin")); 161 printOut(thing.nested([], "magasin"));
160 print(thing.nested([bob, bob], "magasin")); 162 printOut(thing.nested([bob, bob], "magasin"));
161 print(thing.nested([alice, alice], "magasin")); 163 printOut(thing.nested([alice, alice], "magasin"));
162 164
163 print(outerPlural(0)); 165 printOut(outerPlural(0));
164 print(outerPlural(1)); 166 printOut(outerPlural(1));
165 print(outerGender("male")); 167 printOut(outerGender("male"));
166 print(outerGender("female")); 168 printOut(outerGender("female"));
167 print(nestedOuter(7, "male")); 169 printOut(nestedOuter(7, "male"));
168 print(outerSelect("CDN", 7)); 170 printOut(outerSelect("CDN", 7));
169 print(outerSelect("EUR", 5)); 171 printOut(outerSelect("EUR", 5));
170 print(nestedSelect("CDN", 1)); 172 printOut(nestedSelect("CDN", 1));
171 print(nestedSelect("CDN", 2)); 173 printOut(nestedSelect("CDN", 2));
172 }); 174 });
173 } 175 }
174 176
175 var localeToUse = 'en_US'; 177 var localeToUse = 'en_US';
176 178
177 main() { 179 main() {
178 var fr = new Intl("fr"); 180 var fr = new Intl("fr");
179 var english = new Intl("en_US"); 181 var english = new Intl("en_US");
180 var de = new Intl("de_DE"); 182 var de = new Intl("de_DE");
181 // Throw in an initialize of a null locale to make sure it doesn't throw. 183 // Throw in an initialize of a null locale to make sure it doesn't throw.
182 initializeMessages(null); 184 initializeMessages(null);
183 initializeMessages(fr.locale).then((_) => printStuff(fr)); 185 var f1 = initializeMessages(fr.locale).then((_) => printStuff(fr));
184 initializeMessages(de.locale).then((_) => printStuff(de)); 186 var f2 = initializeMessages(de.locale).then((_) => printStuff(de));
185 printStuff(english); 187 printStuff(english);
188 return Future.wait([f1, f2]);
186 } 189 }
OLDNEW
« no previous file with comments | « pkg/intl/test/message_extraction/print_to_list.dart ('k') | pkg/intl/test/message_extraction/verify_messages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698