diff options
Diffstat (limited to 'clang-tools-extra/unittests/clangd/SourceCodeTests.cpp')
| -rw-r--r-- | clang-tools-extra/unittests/clangd/SourceCodeTests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/SourceCodeTests.cpp b/clang-tools-extra/unittests/clangd/SourceCodeTests.cpp index 9fe923db45b..3148ccca923 100644 --- a/clang-tools-extra/unittests/clangd/SourceCodeTests.cpp +++ b/clang-tools-extra/unittests/clangd/SourceCodeTests.cpp @@ -42,6 +42,16 @@ Range range(const std::pair<int, int> p1, const std::pair<int, int> p2) { return range; } +TEST(SourceCodeTests, lspLength) { + EXPECT_EQ(lspLength(""), 0UL); + EXPECT_EQ(lspLength("ascii"), 5UL); + // BMP + EXPECT_EQ(lspLength("↓"), 1UL); + EXPECT_EQ(lspLength("¥"), 1UL); + // astral + EXPECT_EQ(lspLength("😂"), 2UL); +} + TEST(SourceCodeTests, PositionToOffset) { // line out of bounds EXPECT_THAT_EXPECTED(positionToOffset(File, position(-1, 2)), Failed()); |

