(gc)
| 44 | TestSingleLiveInstance(gc); |
| 45 | |
| 46 | function TestMultiInstance(gc) { |
| 47 | let module = newModule(); |
| 48 | |
| 49 | print("TestMultiInstance..."); |
| 50 | // Note: compute the root instances in another function to be |
| 51 | // sure that {roots} really is the only set of roots to the instances. |
| 52 | let roots = (() => { return [ |
| 53 | newInstance(module, 33), |
| 54 | newInstance(module, 4444), |
| 55 | newInstance(module, 555555) |
| 56 | ];})(); |
| 57 | |
| 58 | (() => { // don't leak references! |
| 59 | print(" [0]..."); |
| 60 | gc(); |
| 61 | assertEquals(33, roots[0].exports.main()); |
| 62 | roots[0] = null; |
| 63 | })(); |
| 64 | |
| 65 | (() => { // don't leak references! |
| 66 | print(" [1]..."); |
| 67 | gc(); |
| 68 | assertEquals(4444, roots[1].exports.main()); |
| 69 | roots[1] = null; |
| 70 | })(); |
| 71 | |
| 72 | (() => { // don't leak references! |
| 73 | print(" [2]..."); |
| 74 | gc(); |
| 75 | assertEquals(555555, roots[2].exports.main()); |
| 76 | roots[2] = null; |
| 77 | })(); |
| 78 | } |
| 79 | |
| 80 | TestMultiInstance(nogc); |
| 81 | TestMultiInstance(gc); |
no test coverage detected