| 491 | it('should stringify an AssignmentNode with custom toString', function () { |
| 492 | // Also checks if custom funcions get passed to the children |
| 493 | const customFunction = function (node, options) { |
| 494 | if (node.type === 'AssignmentNode') { |
| 495 | return node.object.toString(options) + |
| 496 | (node.index ? node.index.toString(options) : '') + |
| 497 | ' equals ' + node.value.toString(options) |
| 498 | } else if (node.type === 'ConstantNode') { |
| 499 | return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')' |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | const object = new SymbolNode('a') |
| 504 | const value = new ConstantNode(1) |