Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
542 B

  1. var traverse = require('../');
  2. var test = require('tape');
  3. test('negative update test', function (t) {
  4. var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ];
  5. var fixed = traverse.map(obj, function (x) {
  6. if (x < 0) this.update(x + 128);
  7. });
  8. t.same(fixed,
  9. [ 5, 6, 125, [ 7, 8, 126, 1 ], { f: 10, g: 115 } ],
  10. 'Negative values += 128'
  11. );
  12. t.same(obj,
  13. [ 5, 6, -3, [ 7, 8, -2, 1 ], { f: 10, g: -13 } ],
  14. 'Original references not modified'
  15. );
  16. t.end();
  17. });