Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/tests/typedObjects.js

Issue 6273062181797888: Issue 505 - [Typed objects] Implement array helper methods (Closed)
Left Patch Set: Created May 17, 2014, 9:03 p.m.
Right Patch Set: Created May 19, 2014, 3:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/typedObjects/arrayTypes.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 array.splice(2, 1); 720 array.splice(2, 1);
721 deepEqual(array.toJS(), [4, 1, 5], "Using splice to remove an element succee ded"); 721 deepEqual(array.toJS(), [4, 1, 5], "Using splice to remove an element succee ded");
722 array.splice(0, 2, 9); 722 array.splice(0, 2, 9);
723 deepEqual(array.toJS(), [9, 5], "Using splice to remove two elements and ins ert one succeeded"); 723 deepEqual(array.toJS(), [9, 5], "Using splice to remove two elements and ins ert one succeeded");
724 array.splice(1, 1, 4, 2, 7); 724 array.splice(1, 1, 4, 2, 7);
725 deepEqual(array.toJS(), [9, 4, 2, 7], "Using splice to remove one element an d insert two succeeded"); 725 deepEqual(array.toJS(), [9, 4, 2, 7], "Using splice to remove one element an d insert two succeeded");
726 array.splice(3, 8); 726 array.splice(3, 8);
727 deepEqual(array.toJS(), [9, 4, 2], "Using splice with excessive count parame ter succeeded"); 727 deepEqual(array.toJS(), [9, 4, 2], "Using splice with excessive count parame ter succeeded");
728 array.splice(9, 1, 3); 728 array.splice(9, 1, 3);
729 deepEqual(array.toJS(), [9, 4, 2, 3], "Using splice with excessive index par ameter succeeded"); 729 deepEqual(array.toJS(), [9, 4, 2, 3], "Using splice with excessive index par ameter succeeded");
730 array.splice(-2, 2, 7); 730 array.splice(-2, 1, 7);
731 deepEqual(array.toJS(), [7, 2, 3], "Using splice with negative index paramet er succeeded"); 731 deepEqual(array.toJS(), [9, 4, 7, 3], "Using splice with negative index para meter succeeded");
732 array.splice(-20, 2, 10);
733 deepEqual(array.toJS(), [10, 7, 3], "Using splice with excessive negative in dex parameter succeeded");
732 }); 734 });
733 735
734 test("String type", function() 736 test("String type", function()
735 { 737 {
736 let {string} = require("typedObjects"); 738 let {string} = require("typedObjects");
737 739
738 let s1 = string(); 740 let s1 = string();
739 ok(s1, "String created without parameters"); 741 ok(s1, "String created without parameters");
740 equal(s1.length, 0, "String length is zero"); 742 equal(s1.length, 0, "String length is zero");
741 equal(s1.toString(), "", "JavaScript representation is empty string"); 743 equal(s1.toString(), "", "JavaScript representation is empty string");
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 s11.release(); 802 s11.release();
801 803
802 let s12 = string(s8, 4); 804 let s12 = string(s8, 4);
803 ok(s12, "String created as typed substring without length parameter"); 805 ok(s12, "String created as typed substring without length parameter");
804 equal(s12.length, 10, "String length set correctly"); 806 equal(s12.length, 10, "String length set correctly");
805 equal(s12.toString(), "longstring", "JavaScript representation is correct"); 807 equal(s12.toString(), "longstring", "JavaScript representation is correct");
806 s12.release(); 808 s12.release();
807 s8.release(); 809 s8.release();
808 }); 810 });
809 })(); 811 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld