Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js |
— | — | @@ -70,9 +70,11 @@ |
71 | 71 | var parser = new PegParser(); |
72 | 72 | |
73 | 73 | var testFileName = '../../../../phase3/tests/parser/parserTests.txt'; // default |
| 74 | +var testFileName2 = '../../../../tests/parser/parserTests.txt'; // Fallback. Not everyone fetch at phase3 level |
74 | 75 | if (process.argv.length > 2) { |
75 | 76 | // hack :D |
76 | 77 | testFileName = process.argv[2]; |
| 78 | + testFileName2 = null; |
77 | 79 | console.log(testFileName); |
78 | 80 | } |
79 | 81 | |
— | — | @@ -82,9 +84,17 @@ |
83 | 85 | console.log(e); |
84 | 86 | } |
85 | 87 | |
86 | | -var testFile = fs.readFileSync(testFileName, 'utf8'); |
| 88 | +var testFile; |
| 89 | +try { |
| 90 | + testFile = fs.readFileSync(testFileName, 'utf8'); |
| 91 | +} catch (e) { |
| 92 | + // Try opening fallback file |
| 93 | + if( testFileName2 !== '' ) { |
| 94 | + try { testFile = fs.readFileSync( testFileName2, 'utf8' ); } |
| 95 | + catch(e) { console.log(e); } |
| 96 | + } |
| 97 | +} |
87 | 98 | |
88 | | - |
89 | 99 | try { |
90 | 100 | var cases = testParser.parse(testFile); |
91 | 101 | } catch (e) { |