-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: add toASCII and toUnicode punycode tests #9741
test: add toASCII and toUnicode punycode tests #9741
Conversation
{ | ||
string: 'ليهمابتكلموشعربي؟', | ||
encoded: 'egbpdaj6bu4bxfgehfvwxn', | ||
decoded: '\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644\u0645' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't decoded
just a copy of string
? If so can't we just use string
and encoded
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could. Why did the test use the \u
codes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe because that's how the sample strings are listed in the RFC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we can probably just remove them if they server no purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's how they appear in the RFC, I'd say maybe leave them just in case? It might also help in debugging, if the test ever starts failing, to have the bytecodes handy. We could just stick with decoded
though
'\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74\uC5BC\uB9C8\uB098\uC88B' + | ||
'\uC744\uAE4C', | ||
{ | ||
string: '세계의모든사람들이한국어를이해한다면얼마나좋을까', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I Guide this sentence like "세계의 모든 사람들이 한국어를 이해한다면 얼마나 좋을까"
7557cfc
to
4452fc0
Compare
I've removed the duplicitous New CI: https://ci.nodejs.org/job/node-test-pull-request/4961/ |
4452fc0
to
c660c24
Compare
toASCII: (test) => assert.strictEqual( | ||
punycode.toASCII(test.decoded), | ||
regexNonASCII.test(test.decoded) | ||
? 'xn--' + test.encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use template literal?
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js
c660c24
to
8beee2a
Compare
CI Failure seems unrelated |
I'll merge this tomorrow if there's no objections |
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: #9741 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in c2f8487 |
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: #9741 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: nodejs#9741 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: #9741 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: #9741 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: #9741 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change