-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #783 from JamesMcIntosh:main
PiperOrigin-RevId: 603322548
- Loading branch information
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
library message_lookup_by_library_test; | ||
|
||
import 'package:intl/message_lookup_by_library.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('Resolves message successfully after unsuccessful lookup', () { | ||
final CompositeMessageLookup lookup = CompositeMessageLookup(); | ||
final lookupMessage = | ||
lookup.lookupMessage('Hello', 'pt', 'greeting', null, null); | ||
expect(lookupMessage, 'Hello'); | ||
|
||
lookup.addLocale( | ||
'pt', | ||
(locale) => | ||
TestMessageLookupByLibrary('pt', {'greeting': () => 'Bom dia'}), | ||
); | ||
|
||
final lookupMessage2 = | ||
lookup.lookupMessage('Hello', 'pt', 'greeting', null, null); | ||
expect(lookupMessage2, 'Bom dia'); | ||
}); | ||
} | ||
|
||
class TestMessageLookupByLibrary extends MessageLookupByLibrary { | ||
@override | ||
final Map<String, dynamic> messages; | ||
|
||
@override | ||
final String localeName; | ||
|
||
TestMessageLookupByLibrary(this.localeName, this.messages); | ||
} |