================
@@ -436,4 +442,124 @@ TEST_F(HighlighterTest, SwiftClosures) {
EXPECT_EQ(" <k>let</k> closure = { (x: <k>Int</k>) in return x * 2 }",
highlightSwift(" let closure = { (x: Int) in return x * 2 }", s));
}
+
+static std::string
+highlightRust(llvm::StringRef code, HighlightStyle style,
+ std::optional<size_t> cursor = std::optional<size_t>()) {
+ HighlighterManager mgr;
+ const Highlighter &h =
+ mgr.getHighlighterFor(lldb::eLanguageTypeRust, "main.rs");
+ return h.Highlight(style, code, cursor);
+}
+
+TEST_F(HighlighterTest, RustComments) {
+ HighlightStyle s;
+ s.comment.Set("<cc>", "</cc>");
+
+ EXPECT_EQ(" <cc>// I'm feeling lucky today</cc>",
+ highlightRust(" // I'm feeling lucky today", s));
+ EXPECT_EQ(" <cc>/* This is a\nmultiline comment */</cc>",
+ highlightRust(" /* This is a\nmultiline comment */", s));
+ EXPECT_EQ(" <cc>/* nested /* comment */ works */</cc>",
+ highlightRust(" /* nested /* comment */ works */", s));
+ EXPECT_EQ(" <cc>/// Documentation comment</cc>",
+ highlightRust(" /// Documentation comment", s));
+ EXPECT_EQ(" <cc>//! Inner doc comment</cc>",
+ highlightRust(" //! Inner doc comment", s));
+}
----------------
JDevlieghere wrote:
That's a good summary!
https://github.com/llvm/llvm-project/pull/181282
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits