| 294 | it('should stringify a RangeNode with custom toString', function () { |
| 295 | // Also checks if the custom functions get passed on to the children |
| 296 | const customFunction = function (node, options) { |
| 297 | if (node.type === 'RangeNode') { |
| 298 | return 'from ' + node.start.toString(options) + |
| 299 | ' to ' + node.end.toString(options) + |
| 300 | ' with steps of ' + node.step.toString(options) |
| 301 | } else if (node.type === 'ConstantNode') { |
| 302 | return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')' |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | const a = new ConstantNode(1) |
| 307 | const b = new ConstantNode(2) |