diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-08-17 15:22:46 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-08-17 15:22:46 -0500 |
commit | 14602ba5ffd0d84c80dda3ce6dca9636ffcd3118 (patch) | |
tree | d6eba540bcd8b6beb8f70117c8be34df2c157dbb /tests | |
parent | Merge pull request #5490 (diff) | |
parent | functional_tests: test creating wallets with local language names (diff) | |
download | monero-14602ba5ffd0d84c80dda3ce6dca9636ffcd3118.tar.xz |
Merge pull request #5504
eeca5ca epee: support unicode in parsed strings (moneromooo-monero)
3e11bb5 functional_tests: test creating wallets with local language names (moneromooo-monero)
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/functional_tests/wallet_address.py | 5 | ||||
-rw-r--r-- | tests/unit_tests/epee_utils.cpp | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/tests/functional_tests/wallet_address.py b/tests/functional_tests/wallet_address.py index 4ff059a6f..eda52b432 100755 --- a/tests/functional_tests/wallet_address.py +++ b/tests/functional_tests/wallet_address.py @@ -198,8 +198,9 @@ class WalletAddressTest(): try: wallet.close_wallet() except: pass languages = res.languages - for language in languages: - print('Creating ' + str(language) + ' wallet') + languages_local = res.languages_local + for language in languages + languages_local: + print('Creating ' + language.encode('utf8') + ' wallet') wallet.create_wallet(filename = '', language = language) res = wallet.query_key('mnemonic') wallet.close_wallet() diff --git a/tests/unit_tests/epee_utils.cpp b/tests/unit_tests/epee_utils.cpp index 946731826..c5f9a42d0 100644 --- a/tests/unit_tests/epee_utils.cpp +++ b/tests/unit_tests/epee_utils.cpp @@ -946,3 +946,20 @@ TEST(parsing, number) epee::misc_utils::parse::match_number(i, s.end(), val); ASSERT_EQ(val, "+9.34e+03"); } + +TEST(parsing, unicode) +{ + std::string bs; + std::string s; + std::string::const_iterator si; + + s = "\"\""; si = s.begin(); ASSERT_TRUE(epee::misc_utils::parse::match_string(si, s.end(), bs)); ASSERT_EQ(bs, ""); + s = "\"\\u0000\""; si = s.begin(); ASSERT_TRUE(epee::misc_utils::parse::match_string(si, s.end(), bs)); ASSERT_EQ(bs, std::string(1, '\0')); + s = "\"\\u0020\""; si = s.begin(); ASSERT_TRUE(epee::misc_utils::parse::match_string(si, s.end(), bs)); ASSERT_EQ(bs, " "); + s = "\"\\u1\""; si = s.begin(); ASSERT_FALSE(epee::misc_utils::parse::match_string(si, s.end(), bs)); + s = "\"\\u12\""; si = s.begin(); ASSERT_FALSE(epee::misc_utils::parse::match_string(si, s.end(), bs)); + s = "\"\\u123\""; si = s.begin(); ASSERT_FALSE(epee::misc_utils::parse::match_string(si, s.end(), bs)); + s = "\"\\u1234\""; si = s.begin(); ASSERT_TRUE(epee::misc_utils::parse::match_string(si, s.end(), bs)); ASSERT_EQ(bs, "ሴ"); + s = "\"foo\\u1234bar\""; si = s.begin(); ASSERT_TRUE(epee::misc_utils::parse::match_string(si, s.end(), bs)); ASSERT_EQ(bs, "fooሴbar"); + s = "\"\\u3042\\u307e\\u3084\\u304b\\u3059\""; si = s.begin(); ASSERT_TRUE(epee::misc_utils::parse::match_string(si, s.end(), bs)); ASSERT_EQ(bs, "あまやかす"); +} |