diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2022-04-08 22:48:00 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2022-04-08 22:54:11 +0900 |
| commit | ba36a38a6c4be38fe4e09cc95a40b58a48daed79 (patch) | |
| tree | 6110994e4a9f28608da92e41b235990257ba13eb /test/ValueBaseBencodeParserTest.cc | |
| parent | 37a7419fed8e6035a77c30bef456e36cbfd60245 (diff) | |
Allow empty dist name in bencode which is needed for hybrid torrent
Diffstat (limited to 'test/ValueBaseBencodeParserTest.cc')
| -rw-r--r-- | test/ValueBaseBencodeParserTest.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ValueBaseBencodeParserTest.cc b/test/ValueBaseBencodeParserTest.cc index 30cca2f4..2e12ec49 100644 --- a/test/ValueBaseBencodeParserTest.cc +++ b/test/ValueBaseBencodeParserTest.cc @@ -208,6 +208,16 @@ void ValueBaseBencodeParserTest::testParseUpdate() // Get trailing garbage position CPPUNIT_ASSERT_EQUAL((ssize_t)7, error); } + { + // dict, empty member name + std::string src = "d0:i123ee"; + std::shared_ptr<ValueBase> d = + parser.parseFinal(src.c_str(), src.size(), error); + Dict* dict = downcast<Dict>(d); + CPPUNIT_ASSERT(dict); + CPPUNIT_ASSERT(dict->get("")); + CPPUNIT_ASSERT_EQUAL((int64_t)123, downcast<Integer>(dict->get(""))->i()); + } } } // namespace aria2 |
