summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-19 15:59:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-19 15:59:19 +0000
commite64d9037658a1b95c79ea275af6167a110b3c563 (patch)
tree79bac7a7812f12b2c41875e32869b4ff9d5e79b2 /unittests
parent11b652d41d0d97380ab321a1dba48ecb044f9de8 (diff)
Introduce Lexer::getSourceText() that returns a string for the source
that the given source range encompasses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Lex/LexerTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/Lex/LexerTest.cpp b/unittests/Lex/LexerTest.cpp
index 05478eef9f..fecdb7fc05 100644
--- a/unittests/Lex/LexerTest.cpp
+++ b/unittests/Lex/LexerTest.cpp
@@ -114,6 +114,11 @@ TEST_F(LexerTest, LexAPI) {
EXPECT_EQ(range.getAsRange(),
SourceRange(macroRange.getBegin(),
macroRange.getEnd().getLocWithOffset(1)));
+
+ StringRef text = Lexer::getSourceText(
+ CharSourceRange::getTokenRange(SourceRange(lsqrLoc, rsqrLoc)),
+ SourceMgr, LangOpts);
+ EXPECT_EQ(text, "M(foo)");
}
} // anonymous namespace