This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Convert lit code completion tests to unit-tests. NFC
ClosedPublic

Authored by sammccall on Dec 7 2017, 6:08 AM.

Event Timeline

sammccall created this revision.Dec 7 2017, 6:08 AM
ilya-biryukov accepted this revision.Dec 8 2017, 2:35 AM

LGTM

unittests/clangd/CodeCompleteTests.cpp
289

The ^ symbol conflicts with the corresponding operator.
Even though it's not widely used, I'm wondering whether we should use a different marker for completion position.

335

The formatting is a bit weird. Is this a clang-format bug?

This revision is now accepted and ready to land.Dec 8 2017, 2:35 AM
ioeric accepted this revision.Dec 8 2017, 2:47 AM

lg

unittests/clangd/Matchers.h
54

override?

77

It would be helpful to provide a bit documentation here.

sammccall updated this revision to Diff 126114.Dec 8 2017, 3:16 AM
sammccall marked an inline comment as done.

Reformat around code-complete testcases

sammccall updated this revision to Diff 126116.Dec 8 2017, 3:59 AM

Add documentation to matcher implementation.

sammccall marked 2 inline comments as done.Dec 8 2017, 7:01 AM
sammccall added inline comments.
unittests/clangd/CodeCompleteTests.cpp
289

Almost all characters conflict with something in C++ :-(
^ is rarely going to cause problems and is suggestive of an insertion point.

The failure modes here don't seem worth worrying about:

  • we add a test that needs to use ^. The assert fires, it's easy to tell what happened, and we have to add escaping or change the notation. Annoying, but easy to detect and pretty unlikely.
  • we add a test that needs to use exactly one ^, *and* we forget to add the cursor marker to the test. The assert doesn't fire, the test fails in some random way. This is really annoying, but also vanishingly unlikely.

(I'd feel differently if this wasn't just a local test helper of course)

335

Weird formatting is a clang-format *feature*.
I reformatted all the tests, now they're weird in a different way.

This revision was automatically updated to reflect the committed changes.
test/clangd/completion-priorities.test