|
| 1 | +import is_paired from require 'matching_brackets' |
| 2 | + |
| 3 | +describe 'matching-brackets', -> |
| 4 | + it 'paired square brackets', -> |
| 5 | + assert.is_true is_paired '[]' |
| 6 | + |
| 7 | + pending 'empty string', -> |
| 8 | + assert.is_true is_paired '' |
| 9 | + |
| 10 | + pending 'unpaired brackets', -> |
| 11 | + assert.is_false is_paired '[[' |
| 12 | + |
| 13 | + pending 'wrong ordered brackets', -> |
| 14 | + assert.is_false is_paired '}{' |
| 15 | + |
| 16 | + pending 'wrong closing bracket', -> |
| 17 | + assert.is_false is_paired '{]' |
| 18 | + |
| 19 | + pending 'paired with whitespace', -> |
| 20 | + assert.is_true is_paired '{ }' |
| 21 | + |
| 22 | + pending 'partially paired brackets', -> |
| 23 | + assert.is_false is_paired '{[])' |
| 24 | + |
| 25 | + pending 'simple nested brackets', -> |
| 26 | + assert.is_true is_paired '{[]}' |
| 27 | + |
| 28 | + pending 'several paired brackets', -> |
| 29 | + assert.is_true is_paired '{}[]' |
| 30 | + |
| 31 | + pending 'paired and nested brackets', -> |
| 32 | + assert.is_true is_paired '([{}({}[])])' |
| 33 | + |
| 34 | + pending 'unopened closing brackets', -> |
| 35 | + assert.is_false is_paired '{[)][]}' |
| 36 | + |
| 37 | + pending 'unpaired and nested brackets', -> |
| 38 | + assert.is_false is_paired '([{])' |
| 39 | + |
| 40 | + pending 'paired and wrong nested brackets', -> |
| 41 | + assert.is_false is_paired '[({]})' |
| 42 | + |
| 43 | + pending 'paired and wrong nested brackets but innermost are correct', -> |
| 44 | + assert.is_false is_paired '[({}])' |
| 45 | + |
| 46 | + pending 'paired and incomplete brackets', -> |
| 47 | + assert.is_false is_paired '{}[' |
| 48 | + |
| 49 | + pending 'too many closing brackets', -> |
| 50 | + assert.is_false is_paired '[]]' |
| 51 | + |
| 52 | + pending 'early unexpected brackets', -> |
| 53 | + assert.is_false is_paired ')()' |
| 54 | + |
| 55 | + pending 'early mismatched brackets', -> |
| 56 | + assert.is_false is_paired '{)()' |
| 57 | + |
| 58 | + pending 'math expression', -> |
| 59 | + assert.is_true is_paired '(((185 + 223.85) * 15) - 543)/2' |
| 60 | + |
| 61 | + pending 'complex latex expression', -> |
| 62 | + assert.is_true is_paired '\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)' |
0 commit comments