[AMDGPU][AsmParser][NFC] Translate parsed MIMG instructions to MCInsts automatically.
[llvm-project.git] / clang-tools-extra / clangd / unittests / DraftStoreTests.cpp
blob9d202e40113fec0c4529247752ad395472f16b0e
1 //===-- DraftStoreTests.cpp -------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "DraftStore.h"
10 #include "gmock/gmock.h"
11 #include "gtest/gtest.h"
13 namespace clang {
14 namespace clangd {
15 namespace {
17 TEST(DraftStore, Versions) {
18 DraftStore DS;
19 Path File = "foo.cpp";
21 EXPECT_EQ("25", DS.addDraft(File, "25", ""));
22 EXPECT_EQ("25", DS.getDraft(File)->Version);
23 EXPECT_EQ("", *DS.getDraft(File)->Contents);
25 EXPECT_EQ("26", DS.addDraft(File, "", "x"));
26 EXPECT_EQ("26", DS.getDraft(File)->Version);
27 EXPECT_EQ("x", *DS.getDraft(File)->Contents);
29 EXPECT_EQ("27", DS.addDraft(File, "", "x")) << "no-op change";
30 EXPECT_EQ("27", DS.getDraft(File)->Version);
31 EXPECT_EQ("x", *DS.getDraft(File)->Contents);
33 // We allow versions to go backwards.
34 EXPECT_EQ("7", DS.addDraft(File, "7", "y"));
35 EXPECT_EQ("7", DS.getDraft(File)->Version);
36 EXPECT_EQ("y", *DS.getDraft(File)->Contents);
39 } // namespace
40 } // namespace clangd
41 } // namespace clang