encoding: treat TLV-TYPE zero as invalid
* Use tlv::Invalid to indicate an invalid Block, instead of
UINT32_MAX (which is a valid type), thus fixing bug #4726
* Introduce Block::isValid as a replacement for Block::empty
and soft-deprecate the latter
* Improve test coverage of Block and tlv::readType
Refs: #4726, #4895
Change-Id: I1cd3336fcbfe83555f3111738da67041dfae64f3
diff --git a/tests/unit/name-component.t.cpp b/tests/unit/name-component.t.cpp
index 6f5bffc..4ee25ea 100644
--- a/tests/unit/name-component.t.cpp
+++ b/tests/unit/name-component.t.cpp
@@ -141,7 +141,7 @@
BOOST_AUTO_TEST_CASE(InvalidType)
{
Component comp;
- BOOST_CHECK_THROW(comp.wireDecode("0001 80"_block), Component::Error);
+ BOOST_CHECK_THROW(comp.wireDecode(Block{}), Component::Error);
BOOST_CHECK_THROW(comp.wireDecode("FE0001000001 80"_block), Component::Error);
BOOST_CHECK_THROW(Component::fromEscapedString("0=A"), Component::Error);