Accessor renames on diagnostics+source buffer (#1133)

This commit is contained in:
Jon Meow
2022-03-15 15:43:53 -07:00
committed by GitHub
parent ad9c10da16
commit 7bbf4fbba3
7 changed files with 50 additions and 49 deletions
+8 -8
View File
@@ -16,16 +16,16 @@ namespace {
TEST(SourceBufferTest, StringRep) {
auto buffer = SourceBuffer::CreateFromText(llvm::Twine("Hello") + " World");
EXPECT_EQ("/text", buffer->Filename());
EXPECT_EQ("Hello World", buffer->Text());
EXPECT_EQ("/text", buffer->filename());
EXPECT_EQ("Hello World", buffer->text());
}
TEST(SourceBufferText, StringRepWithFilename) {
// Give a custom filename.
auto buffer =
SourceBuffer::CreateFromText("Hello World Again!", "/custom/text");
EXPECT_EQ("/custom/text", buffer->Filename());
EXPECT_EQ("Hello World Again!", buffer->Text());
EXPECT_EQ("/custom/text", buffer->filename());
EXPECT_EQ("Hello World Again!", buffer->text());
}
auto CreateTestFile(llvm::StringRef text) -> std::string {
@@ -54,8 +54,8 @@ TEST(SourceBufferTest, FileRep) {
SourceBuffer& buffer = *expected_buffer;
EXPECT_EQ(test_file_path, buffer.Filename());
EXPECT_EQ("Hello World", buffer.Text());
EXPECT_EQ(test_file_path, buffer.filename());
EXPECT_EQ("Hello World", buffer.text());
}
TEST(SourceBufferTest, FileRepEmpty) {
@@ -67,8 +67,8 @@ TEST(SourceBufferTest, FileRepEmpty) {
SourceBuffer& buffer = *expected_buffer;
EXPECT_EQ(test_file_path, buffer.Filename());
EXPECT_EQ("", buffer.Text());
EXPECT_EQ(test_file_path, buffer.filename());
EXPECT_EQ("", buffer.text());
}
} // namespace