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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/test/address_data_test.cc

Issue 135853023: Update libaddressinput's US address format (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 6 years, 11 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 | « third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc ('k') | no next file » | 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) 2014 Google Inc. 1 // Copyright (C) 2014 Google Inc.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 12 matching lines...) Expand all
23 23
24 using i18n::addressinput::AddressData; 24 using i18n::addressinput::AddressData;
25 25
26 TEST(AddressDataTest, FormatForDisplayEmpty) { 26 TEST(AddressDataTest, FormatForDisplayEmpty) {
27 AddressData address; 27 AddressData address;
28 std::vector<std::string> actual; 28 std::vector<std::string> actual;
29 address.FormatForDisplay(&actual); 29 address.FormatForDisplay(&actual);
30 EXPECT_EQ(std::vector<std::string>(), actual); 30 EXPECT_EQ(std::vector<std::string>(), actual);
31 } 31 }
32 32
33 TEST(AddressDataTest, FormatForDisplayUs) {
34 AddressData address;
35 address.country_code = "US";
36 address.administrative_area = "Texas";
37 address.locality = "Houston";
38 address.postal_code = "77005";
39 address.address_lines.push_back("123 Main St");
40 address.address_lines.push_back("Apt 2");
41 address.organization = "ACME Corp.";
42 address.recipient = "John Doe";
43
44 std::vector<std::string> actual;
45 address.FormatForDisplay(&actual);
46
47 std::vector<std::string> expected;
48 expected.push_back(address.recipient);
49 expected.push_back(address.organization);
50 expected.insert(expected.end(),
51 address.address_lines.begin(),
52 address.address_lines.end());
53 expected.push_back(address.locality + ", " + address.administrative_area +
54 " " + address.postal_code);
55
56 EXPECT_EQ(expected, actual);
57 }
58
33 TEST(AddressDataTest, FormatForDisplayAr) { 59 TEST(AddressDataTest, FormatForDisplayAr) {
34 AddressData address; 60 AddressData address;
35 address.country_code = "AR"; 61 address.country_code = "AR";
36 address.administrative_area = "Capital Federal"; 62 address.administrative_area = "Capital Federal";
37 address.locality = "Buenos Aires"; 63 address.locality = "Buenos Aires";
38 address.postal_code = "C1001AFB"; 64 address.postal_code = "C1001AFB";
39 address.address_lines.push_back("Su Calle 123"); 65 address.address_lines.push_back("Su Calle 123");
40 address.address_lines.push_back("5° Piso"); 66 address.address_lines.push_back("5° Piso");
41 address.organization = "Empresa Ejemplo"; 67 address.organization = "Empresa Ejemplo";
42 address.recipient = "Juan Perez"; 68 address.recipient = "Juan Perez";
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 std::vector<std::string> expected( 140 std::vector<std::string> expected(
115 1, 141 1,
116 address.sorting_code + " " + 142 address.sorting_code + " " +
117 address.locality + " " + 143 address.locality + " " +
118 address.sorting_code); 144 address.sorting_code);
119 145
120 EXPECT_EQ(expected, actual); 146 EXPECT_EQ(expected, actual);
121 } 147 }
122 148
123 } // namespace 149 } // namespace
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/cpp/src/region_data_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698