Skip to content

Conversation

@netdpb
Copy link
Collaborator

@netdpb netdpb commented Feb 1, 2024

Partially fixes #141.

netdpb added 12 commits January 29, 2024 16:48
…d reduce their accessibility.

Make `ReportedFact.matches()` take `ExpectedFact`.
Merge `ReportedFact.expectedFact()` with `ReportedFact.getFactText()`.
Move the static methods that create fact text into `ReportedFact` since they're meant to be called by its implementations.
commit 87a8b19a2f7ba3ce2bb4819dd663afe05baad181
Author: David P. Baker <dpb@google.com>
Date:   Tue Jan 30 18:11:05 2024 -0500

    Check for test names with no facts, and for nonunique test names.

commit d866e68ea8d0795da703d32dcade7dafec41aecf
Author: David P. Baker <dpb@google.com>
Date:   Tue Jan 30 15:27:05 2024 -0500

    Fix test name trimming.

commit c2abc29d50ce2232a7177c75d781cb85580b70a6
Author: David P. Baker <dpb@google.com>
Date:   Tue Jan 30 15:24:25 2024 -0500

    Reorder methods.

commit 3bb6961ae402486cd42b460728d9c70d5f8b96c4
Author: David P. Baker <dpb@google.com>
Date:   Tue Jan 30 15:23:52 2024 -0500

    Change `getIdentifier()` to return `String`.

commit 9aebe183c72734e2c38027db04eaa8ac18a77609
Author: David P. Baker <dpb@google.com>
Date:   Tue Jan 30 15:23:24 2024 -0500

    Extract `setTestName()`.

commit d69cb145c008c62e93b006c9aba09d83d8556446
Author: David P. Baker <dpb@google.com>
Date:   Tue Jan 30 15:16:24 2024 -0500

    Merge changes from test-names-prep.

commit 57f1dec
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 16:24:22 2024 -0500

    Refactoring.

commit e7ff8c2
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 14:42:52 2024 -0500

    Refactoring.

commit 0e31b76
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 14:30:11 2024 -0500

    Simplify.

commit f5accfb
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 14:07:14 2024 -0500

    Check that the test name is set only once per line, and before assertions.

commit 3ceaf2d
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 12:57:23 2024 -0500

    More tests.

commit 02b8de8
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 12:56:45 2024 -0500

    Trim trailing whitespace on the expectation.

commit 4c58ae1
Merge: 6979a2e 6c94972
Author: David P. Baker <dpb@google.com>
Date:   Mon Jan 29 11:57:05 2024 -0500

    Merge branch 'main' of github.com:jspecify/nullness-checker-for-checker-framework into test-names

commit 6979a2e
Author: David P. Baker <dpb@google.com>
Date:   Fri Jan 26 18:46:38 2024 -0500

    Add unit tests for `ExpectedFact.Reader`.

commit 3f2321f
Author: David P. Baker <dpb@google.com>
Date:   Fri Jan 26 18:45:17 2024 -0500

    Use a builder for `ConformanceTestReport`.
    Use one reader for all files.
    Report parse errors.

commit 6a2760f
Author: David P. Baker <dpb@google.com>
Date:   Fri Jan 26 11:46:52 2024 -0500

    Allow test name to be used as an identifier instead of the line number.

    Use a colon between the line number or test name and the expected fact, rather than a space.

commit b97cd65
Author: David P. Baker <dpb@google.com>
Date:   Fri Jan 26 11:28:39 2024 -0500

    Match a `// test:name:` line.

commit 25b01d6
Author: David P. Baker <dpb@google.com>
Date:   Fri Jan 26 11:23:08 2024 -0500

    Make `ReportedFact.matches()` take an `ExpectedFact` instead of a string.

commit 162009c
Author: David P. Baker <dpb@google.com>
Date:   Fri Jan 26 10:54:31 2024 -0500

    Combine all the assertion patterns into one regex.

commit e1b0efd
Author: David P. Baker <dpb@google.com>
Date:   Thu Jan 25 16:25:25 2024 -0500

    Formatting.

commit 4c2b4a3
Author: David P. Baker <dpb@google.com>
Date:   Thu Jan 25 13:50:29 2024 -0500

    Make `Fact`, `ExpectedFact`, and `ReportedFact` top-level instead of nested classes.

commit 1a86077
Author: David P. Baker <dpb@google.com>
Date:   Thu Jan 25 11:37:18 2024 -0500

    Refactor CTR in advance of supporting test names.
@netdpb netdpb requested review from cpovirk and wmdietl February 1, 2024 19:08
@netdpb
Copy link
Collaborator Author

netdpb commented Feb 5, 2024

Ping for review.

Copy link
Collaborator

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One possible corner case to look at, otherwise looks good.

}
check(this.testName == null, "test name already set");
check(facts.isEmpty(), "test name must come before assertions for a line");
this.testName = testName.trim();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this first check that the test name isn't empty?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Split the check for all-digits from the check for colons.
@netdpb netdpb merged commit 7755009 into jspecify:main Feb 6, 2024
@netdpb netdpb deleted the test-names branch February 6, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support naming conformance test assertions

2 participants