diff options
author | Christian Parpart <christian@ethereum.org> | 2018-11-28 23:19:22 +0800 |
---|---|---|
committer | Christian Parpart <christian@ethereum.org> | 2018-12-01 00:07:12 +0800 |
commit | c48a5264be4221873fe02cac57f6a41a32010fea (patch) | |
tree | 441c9c554fb9521f41f4a143dc138a33afb03589 /test/liblangutil | |
parent | 22eff22492b2d569fe56b59763ddc1cd1cf9ccf4 (diff) | |
download | dexon-solidity-c48a5264be4221873fe02cac57f6a41a32010fea.tar.gz dexon-solidity-c48a5264be4221873fe02cac57f6a41a32010fea.tar.zst dexon-solidity-c48a5264be4221873fe02cac57f6a41a32010fea.zip |
liblangutil: SourceLocation: adds (shared) pointer to underlying CharStream source, eliminating sourceName
Also, adapted affecting code to those changes.
Diffstat (limited to 'test/liblangutil')
-rw-r--r-- | test/liblangutil/SourceLocation.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
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<CharStream>("", "source"); + auto const sourceA = std::make_shared<CharStream>("", "sourceA"); + auto const sourceB = std::make_shared<CharStream>("", "sourceB"); + BOOST_CHECK(SourceLocation() == SourceLocation()); - BOOST_CHECK(SourceLocation(0, 3, std::make_shared<std::string>("sourceA")) != SourceLocation(0, 3, std::make_shared<std::string>("sourceB"))); - BOOST_CHECK(SourceLocation(0, 3, std::make_shared<std::string>("source")) == SourceLocation(0, 3, std::make_shared<std::string>("source"))); - BOOST_CHECK(SourceLocation(3, 7, std::make_shared<std::string>("source")).contains(SourceLocation(4, 6, std::make_shared<std::string>("source")))); - BOOST_CHECK(!SourceLocation(3, 7, std::make_shared<std::string>("sourceA")).contains(SourceLocation(4, 6, std::make_shared<std::string>("sourceB")))); - BOOST_CHECK(SourceLocation(3, 7, std::make_shared<std::string>("sourceA")) < SourceLocation(4, 6, std::make_shared<std::string>("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() |