From c48a5264be4221873fe02cac57f6a41a32010fea Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 28 Nov 2018 16:19:22 +0100 Subject: liblangutil: SourceLocation: adds (shared) pointer to underlying CharStream source, eliminating sourceName Also, adapted affecting code to those changes. --- test/liblangutil/SourceLocation.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test/liblangutil') diff --git a/test/liblangutil/SourceLocation.cpp b/test/liblangutil/SourceLocation.cpp index ac7a2173..ef4103da 100644 --- a/test/liblangutil/SourceLocation.cpp +++ b/test/liblangutil/SourceLocation.cpp @@ -33,12 +33,16 @@ BOOST_AUTO_TEST_SUITE(SourceLocationTest) BOOST_AUTO_TEST_CASE(test_fail) { + auto const source = std::make_shared("", "source"); + auto const sourceA = std::make_shared("", "sourceA"); + auto const sourceB = std::make_shared("", "sourceB"); + BOOST_CHECK(SourceLocation() == SourceLocation()); - BOOST_CHECK(SourceLocation(0, 3, std::make_shared("sourceA")) != SourceLocation(0, 3, std::make_shared("sourceB"))); - BOOST_CHECK(SourceLocation(0, 3, std::make_shared("source")) == SourceLocation(0, 3, std::make_shared("source"))); - BOOST_CHECK(SourceLocation(3, 7, std::make_shared("source")).contains(SourceLocation(4, 6, std::make_shared("source")))); - BOOST_CHECK(!SourceLocation(3, 7, std::make_shared("sourceA")).contains(SourceLocation(4, 6, std::make_shared("sourceB")))); - BOOST_CHECK(SourceLocation(3, 7, std::make_shared("sourceA")) < SourceLocation(4, 6, std::make_shared("sourceB"))); + BOOST_CHECK(SourceLocation(0, 3, sourceA) != SourceLocation(0, 3, sourceB)); + BOOST_CHECK(SourceLocation(0, 3, source) == SourceLocation(0, 3, source)); + BOOST_CHECK(SourceLocation(3, 7, source).contains(SourceLocation(4, 6, source))); + BOOST_CHECK(!SourceLocation(3, 7, sourceA).contains(SourceLocation(4, 6, sourceB))); + BOOST_CHECK(SourceLocation(3, 7, sourceA) < SourceLocation(4, 6, sourceB)); } BOOST_AUTO_TEST_SUITE_END() -- cgit