| 282 | it('should stringify a ConditionalNode with custom toString', function () { |
| 283 | // Also checks if the custom functions get passed on to the children |
| 284 | const customFunction = function (node, options) { |
| 285 | if (node.type === 'ConditionalNode') { |
| 286 | return 'if ' + node.condition.toString(options) + |
| 287 | ' then ' + node.trueExpr.toString(options) + |
| 288 | ' else ' + node.falseExpr.toString(options) |
| 289 | } else if (node.type === 'ConstantNode') { |
| 290 | return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')' |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | const a = new ConstantNode(1) |
| 295 | const b = new ConstantNode(2) |