Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content assist proposals sometimes invoked at test comment instead of test DSL #345

Closed
trancexpress opened this issue May 27, 2024 · 3 comments

Comments

@trancexpress
Copy link
Contributor

Opening an issue since I don't see a discussions section for Xpect.

We have more or less the following test DSL:

    keyword1 name1 {
        // Verify that keyword2.property10, keyword2.property20, keyword2.property30 and
        // keyword2.property40 are not shown.
        // XPECT proposals at 'keyword2.|' --> property1, property2, property3
        // XPECT proposals at '=|' --> value1, value2
        // Verify that safety lines are shown for keyword2.property1
        keyword2.property1 = value1;
    }

When I remove the 2nd XPECT statement, or run this test with my JUnit 5 changes (see #343), the test fails. It fails due due to the wrong offset provided by org.eclipse.xpect.parameter.OffsetProvider.getMatchedOffset().

The region in the fail case is within the comment "// Verify that safety lines are shown for keyword2.property1". The region in the pass case is the actually relevant test DSL "keyword2.property1 = value1;".

What is the defined behavior here? Is there some way to mark Xpect comments as Xpect comments and not as potential DSL comments? To "fix" the test fail, I've moved the "confusing" comment to be above the XPECTstatement:

    keyword1 name1 {
        // Verify that keyword2.property10, keyword2.property20, keyword2.property30 and
        // keyword2.property40 are not shown.
        // Verify that safety lines are shown for keyword2.property1
        // XPECT proposals at 'keyword2.|' --> property1, property2, property3
        // XPECT proposals at '=|' --> value1, value2
        keyword2.property1 = value1;
    }

I also don't know why this behavior shows up only without the 2nd XPECT statement with JUnit 4 XpectRunner, but always with my JUnit 5 alternative.

@cdietrich
Copy link
Member

I have not looked at this code for years so I fear you need to debug what the offsetprovider internally does

@cdietrich
Copy link
Member

Ps content assist tests are an advantest internal feature afaik. But I assume others show the same behavior

do you also see the problem with a multiline comment

@trancexpress
Copy link
Contributor Author

trancexpress commented May 27, 2024

do you also see the problem with a multiline comment

You mean like this?

/*
 *
 */

Yes, I still see it.

Alright, I think I was missing this, at the replacement for XpectRunner:

@XpectImport(TestTitleProvider.class)

Probably this is what defines the title of the XPECT test, which is then probably used for some error message or something like that...

@trancexpress trancexpress closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
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

No branches or pull requests

2 participants