Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /** | 1 /** |
| 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
| 4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #library('message_format_test'); | 7 #library('IntlMessageTest'); |
| 8 | 8 |
| 9 #import('../../../lib/i18n/message_format.dart'); | 9 #import('../../../lib/i18n/intl.dart'); |
| 10 #import('../../../lib/i18n/intl_message.dart'); | |
| 10 #import('../../../lib/unittest/unittest.dart'); | 11 #import('../../../lib/unittest/unittest.dart'); |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * Tests the MessageFormat library in dart. | 14 * Tests the MessageFormat library in dart. |
| 14 */ | 15 */ |
| 15 | 16 |
| 16 main() { | 17 main() { |
| 17 test('Message formatting', () { | 18 test('Message formatting', () { |
| 18 var msg_format = new MessageFormat( | 19 msg_format(number) => new IntlMessage( |
| 19 'Message telling user how many emails will be sent.', | 20 Intl.plural(number, |
| 20 '''{NUM_EMAILS_TO_SEND, plural, | 21 {'0': 'There are no emails left.', |
| 21 =0 {unused plural form} | 22 '1': 'There is one email left.', |
| 22 =1 {One email will be sent.} | 23 'other': 'There are $number emails left.'}), |
| 23 other {# emails will be sent.}}'''); | 24 desc: 'Message telling user how many emails will be sent.', |
| 24 // TODO(efortuna): Uncomment when functioning correctly. | 25 examples: {'number': 32}); |
| 25 //Expect.stringEquals('5 emails will be sent.', | 26 msg_format(5); |
| 26 // msg_formatter.format({'NUM_EMAILS_TO_SEND' : 5})); | |
| 27 }); | 27 }); |
| 28 // TODO(efortuna): Uncomment when functioning correctly. | |
| 29 //Expect.stringEquals('5 emails will be sent.', | |
| 30 // msg_format(5)); | |
|
Bob Nystrom
2012/06/06 22:22:48
With gram's new awesome API:
expect(msg_format, e
Emily Fortuna
2012/06/06 22:51:43
Done.
| |
| 28 } | 31 } |
| OLD | NEW |