Skip to content

Util: Use end line instead of start line for actual results - #12212

Merged
hvitved merged 7 commits into
github:mainfrom
hvitved:util/inline-expect-test-use-end-line
Feb 20, 2023
Merged

hvitved merged 7 commits into
github:mainfrom
hvitved:util/inline-expect-test-use-end-line

Conversation

@hvitved

@hvitved hvitved commented Feb 16, 2023

Copy link
Copy Markdown
Contributor

This PR changes the semantics of the inline test expectations framework, from using start-line to using end-line for actual results (we still use start-line for expected results).

The motivation for this is that two entities may share start line, which makes it impossible to add unambiguous test expectations. For example, for chained calls

M1().
M2()

both calls have the same start-line (the output of the call to M1 is an argument of the call to M2), but they have different end lines. By using end-line instead of start-line, we can meaningfully add expectations such as

M1(). // $ calls=M1
M2() // $ calls=M2

@hvitved
hvitved force-pushed the util/inline-expect-test-use-end-line branch from 19c60af to 87bf945 Compare February 17, 2023 12:24
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Feb 17, 2023
@hvitved
hvitved marked this pull request as ready for review February 17, 2023 12:30
@hvitved
hvitved requested review from a team as code owners February 17, 2023 12:30
@hvitved
hvitved force-pushed the util/inline-expect-test-use-end-line branch from 87bf945 to 59efcd5 Compare February 17, 2023 14:20

@tausbn tausbn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Python bits look good to me. 👍

@owen-mc owen-mc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it looks slightly worse, but maybe I'm just used to the old way, and you do give at least one advantage. Approved for go.

@atorralba atorralba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Java 👍

@geoffw0 geoffw0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Swift 👍. We're adding a lot of tests and models at the moment, I would appreciate if you merge in latest main and re-run the checks just before merging.

@hvitved
hvitved requested a review from a team as a code owner February 20, 2023 09:03
@hvitved
hvitved requested review from asgerf and removed request for a team February 20, 2023 09:03
@hvitved
hvitved merged commit 658cc33 into github:main Feb 20, 2023
@hvitved
hvitved deleted the util/inline-expect-test-use-end-line branch February 20, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants