summaryrefslogtreecommitdiffstats
path: root/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'document/src/tests/fieldvalue/referencefieldvalue_test.cpp')
-rw-r--r--document/src/tests/fieldvalue/referencefieldvalue_test.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/document/src/tests/fieldvalue/referencefieldvalue_test.cpp b/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
index 17fb5ac74e6..d34bbff8a54 100644
--- a/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
+++ b/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
@@ -23,8 +23,8 @@ struct Fixture {
~Fixture();
};
- Fixture::Fixture() = default;
- Fixture::~Fixture() = default;
+ Fixture::Fixture() { }
+ Fixture::~Fixture() { }
}
using vespalib::IllegalArgumentException;
@@ -60,6 +60,17 @@ TEST_F("Exception is thrown if constructor doc ID type does not match referenced
"to reference of document type 'foo'");
}
+TEST_F("Exception is thrown if doc ID does not have a type", Fixture) {
+ // Could have had a special cased message for this, but type-less IDs are
+ // not expected to be allowed through the feed pipeline at all. We just
+ // want to ensure it fails in a controlled fashion if encountered.
+ EXPECT_EXCEPTION(
+ ReferenceFieldValue(f.refType, DocumentId("doc:foo:bario")),
+ IllegalArgumentException,
+ "Can't assign document ID 'doc:foo:bario' (of type '') "
+ "to reference of document type 'foo'");
+}
+
TEST_F("assign()ing a non-reference field value throws exception", Fixture) {
ReferenceFieldValue fv(f.refType);
EXPECT_EXCEPTION(fv.assign(StringFieldValue("waluigi time!!")),