| 207 | it('should stringify an IndexNode with custom toString', function () { |
| 208 | // Also checks if the custom functions get passed on to the children |
| 209 | const customFunction = function (node, options) { |
| 210 | if (node.type === 'IndexNode') { |
| 211 | return node.dimensions.map(function (range) { |
| 212 | return range.toString(options) |
| 213 | }).join(', ') |
| 214 | } else if (node.type === 'ConstantNode') { |
| 215 | return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')' |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | const b = new ConstantNode(1) |
| 220 | const c = new ConstantNode(2) |