Commits

Shlomi Fish committed 26b8405

Add the replaceSubstring method - we'll need it later.

  • Participants
  • Parent commits acba194

Comments (0)

Files changed (2)

File abc-path/js/abc-path-test.js

         deepEqual(mybase._to_xy(3*5+4), [3,4], '_to_xy(3*5+4) -> [3,4]');
     });
 
+    test("Solver.Base _replaceSubstring", function() {
+        expect(1);
+
+        var mybase = new ABC_Path.Solver.Base({});
+        // TEST
+        equals(mybase._replaceSubstring('0123456789', 0, 1, 'foo'),
+            'foo123456789',
+            '_replaceSubstring simple test.');
+    });
+
     test("Solver.Base _y_indexes", function() {
         expect(4);
 

File abc-path/js/abc-path.js

         _y_in_range: function(y) {
             return this._x_in_range(y);
         },
+        _replaceSubstring: function(s, start, end, replacement) {
+            return s.substring(0, start) + replacement + s.substring(end);
+        },
     },
 });
 Class('ABC_Path.Solver.Move', {