Skip to content

#3180. Add more JSAnyOperatorExtension tests #3225

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

Merged
merged 3 commits into from
Jun 18, 2025

Conversation

sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

This LGTM.

@srujzs, do you have further comments? If you're happy then it would be great if you'd land it (I'm traveling for a few days).

Copy link

@srujzs srujzs left a comment

Choose a reason for hiding this comment

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

Just a few nits, thanks!

testGreaterThanOrEqualTo(null);

eval("globalThis.underTest = 0 / 0;");
testGreaterThanOrEqualTo((0 / 0).jsify());
Copy link

Choose a reason for hiding this comment

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

nit: toJS here and other tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated here and below.

testGreaterThanOrEqualTo((0 / 0).jsify());

eval("globalThis.underTest = [0];");
testGreaterThanOrEqualTo([].jsify());
Copy link

Choose a reason for hiding this comment

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

nit: faster to just do <JSAny?>[].toJS since it's an empty list here and other tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated everywhere.

main() {
eval("globalThis.underTest = 42;");
testOr(42.toJS);
/*
Copy link

Choose a reason for hiding this comment

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

Are these meant to be commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for noticing. Rremoved.

);
jsExpectEquals(globalContext["eqTrue"], underTest.strictEquals(true.toJS));

if (isJS) {
Copy link

Choose a reason for hiding this comment

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

I see you've come across our discrepancy on how we have to convert undefined to Dart null in dart2wasm :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes :)


testGreaterThanOrEqualTo(JSAny? underTest) {
eval(r'''
var gtNum = underTest >= 2;
Copy link

@srujzs srujzs Jun 17, 2025

Choose a reason for hiding this comment

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

Sorry, one more comment: prefer globalThis.gtNum here and everywhere over var gtNum so we don't have different behavior if we started using strict mode in JS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated everywhere, thanks.

Copy link
Contributor Author

@sgrekhov sgrekhov left a comment

Choose a reason for hiding this comment

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

Updated. PTAL.


testGreaterThanOrEqualTo(JSAny? underTest) {
eval(r'''
var gtNum = underTest >= 2;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated everywhere, thanks.

testGreaterThanOrEqualTo(null);

eval("globalThis.underTest = 0 / 0;");
testGreaterThanOrEqualTo((0 / 0).jsify());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated here and below.

testGreaterThanOrEqualTo((0 / 0).jsify());

eval("globalThis.underTest = [0];");
testGreaterThanOrEqualTo([].jsify());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated everywhere.

main() {
eval("globalThis.underTest = 42;");
testOr(42.toJS);
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for noticing. Rremoved.

);
jsExpectEquals(globalContext["eqTrue"], underTest.strictEquals(true.toJS));

if (isJS) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes :)

@chloestefantsova chloestefantsova merged commit ef2e4de into dart-lang:master Jun 18, 2025
2 checks passed
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.

4 participants