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

Magic constants are replaced by blob.size #9735

Merged
merged 3 commits into from Mar 1, 2018

Conversation

Projects
None yet
5 participants
@kritisingh1
Copy link
Member

kritisingh1 commented Mar 1, 2018

Closes #2634.

@kritisingh1 kritisingh1 changed the title Blob size Magic constants are replaced by blob.size Mar 1, 2018

@w3c-bots

This comment has been minimized.

Copy link

w3c-bots commented Mar 1, 2018

Build PASSED

Started: 2018-03-01 22:30:40
Finished: 2018-03-01 22:35:20

View more information about this build on:

@inexorabletash
Copy link
Contributor

inexorabletash left a comment

Thanks for this cleanup! A few suggestions...

var sliceBlob = blob.slice(-1, 2000);
assert_equals(sliceBlob.size, 2000-(2000-1), "Bolb slice size");
var sliceBlob = blob.slice(-1, blob.size);
assert_equals(sliceBlob.size, blob.size-(blob.size-1), "Blob slice size");

This comment has been minimized.

Copy link
@inexorabletash

inexorabletash Mar 1, 2018

Contributor

How about just making this 1 instead of blob.size-(blob.size-1) ?

}, "slice start is negative, relativeStart will be max((size + start), 0)");
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(2001, 2000);
assert_equals(sliceBlob.size, 0, "Bolb slice size");
var sliceBlob = blob.slice(blob.size+1, blob.size);

This comment has been minimized.

Copy link
@inexorabletash

inexorabletash Mar 1, 2018

Contributor

nit: add spaces around the operator

}, "slice start is greater than blob size, relativeStart will be min(start, size)");
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(1998, -1);
assert_equals(sliceBlob.size, (2000-1)-1998, "Bolb slice size");
var sliceBlob = blob.slice(blob.size-2, -1);

This comment has been minimized.

Copy link
@inexorabletash

inexorabletash Mar 1, 2018

Contributor

nit: spaces around the operator

var sliceBlob = blob.slice(1998, -1);
assert_equals(sliceBlob.size, (2000-1)-1998, "Bolb slice size");
var sliceBlob = blob.slice(blob.size-2, -1);
assert_equals(sliceBlob.size, (blob.size-1)-1998, "Blob slice size");

This comment has been minimized.

Copy link
@inexorabletash

inexorabletash Mar 1, 2018

Contributor

Don't you want to replace the 1998 here too? Should be blob.size - 2.... or you could again replace the whole expected value with 1

}, "slice end is negative, relativeEnd will be max((size + end), 0)");
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(1998, 2999);
assert_equals(sliceBlob.size, 2000-1998, "Bolb slice size");
var sliceBlob = blob.slice(blob.size-2, blob.size+999);

This comment has been minimized.

Copy link
@inexorabletash

inexorabletash Mar 1, 2018

Contributor

nit: spaces around the operator

@kritisingh1

This comment has been minimized.

Copy link
Member Author

kritisingh1 commented Mar 1, 2018

@inexorabletash I have made the required changes. Thank you 🙂

@inexorabletash
Copy link
Contributor

inexorabletash left a comment

Thanks!

@inexorabletash inexorabletash merged commit bb60bf3 into web-platform-tests:master Mar 1, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.