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

Check usage of quoted strings instead of multiline strings in some Xtend tests #2999

Closed
LorenzoBettini opened this issue Apr 16, 2024 · 7 comments

Comments

@LorenzoBettini
Copy link
Contributor

See #2993 (comment)

@HannesWell
Copy link
Contributor

On a Windows computer you get the full list easily by running a full clean build and check the Git-Staging view for changed files, which gives me:

  • org.eclipse.xtend.core.tests.compiler.CompilerXtendIssue230Test
  • org.eclipse.xtend.core.tests.macro.AbstractReusableActiveAnnotationTests
  • org.eclipse.xtend.core.tests.smoke.SmokeTestCase
  • org.eclipse.xtend.ide.tests.contentassist.Bug365368Test
  • org.eclipse.xtend.ide.tests.contentassist.Issue624Test
  • org.eclipse.xtend.ide.tests.editor.ImportAwareActionTest
  • org.eclipse.xtend.ide.tests.macros.AbstractReusableActiveAnnotationTests

But looking at the affected test cases, I don't think the usage of quoted string was on purpose and not by accident, because the strings using standard java quotes contain metacharacters for Xtend multi line strings like for example

initializer = '''new «type.type»()'''

I can escape ''' using \'\'\', but for « » prepending them with back-slashes seems not to have the desired effect.

@LorenzoBettini
Copy link
Contributor Author

Thanks for the analysis @HannesWell!

@szarnekow do you think we can turn those tests into multiline strings?

@HannesWell
Copy link
Contributor

Your welcome.

I think I found a solution based on this answer: https://groups.google.com/g/xtend-lang/c/bVZ0nKmQGAI
Just put the sequence containing meta-character in a tag as string literal, i.e. wrap it with «" "».

If you are fine with this, I can create a PR this evening.

@LorenzoBettini
Copy link
Contributor Author

But that doesn't escape «» does it?

However, let's postpone this for the moment.

@HannesWell
Copy link
Contributor

But that doesn't escape «» does it?

It does if If wrap it into a tag with a literal string, like «"«»"»

But this becomes a bit cumbersome if there are multiple such elements in a template.

So I'm not sure if it would be 'better' to migrate them directly to Java Text-Blocks.

@LorenzoBettini
Copy link
Contributor Author

I think this can be closed now that #3004 has been merged

@HannesWell
Copy link
Contributor

I think this can be closed now that #3004 has been merged

Thanks a lot for fixing this. It was always annoying to sort-out unrelated changes in git on Windows.

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