-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common function, error handling & unit tests for repl/test
- Loading branch information
Showing
8 changed files
with
184 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
object pepita { | ||
var energia = 0 | ||
var extra = 0 | ||
|
||
// method without parentheses does not parse ok | ||
method energiaTotal = energia + extra | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class A { | ||
method go() { | ||
self = 1 | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { join } from 'path' | ||
import { buildEnvironmentForProject, validateEnvironment } from '../src/utils' | ||
import chaiAsPromised from 'chai-as-promised' | ||
import chai from 'chai' | ||
|
||
describe('build & validating environment', () => { | ||
|
||
const badProjectPath = join('examples', 'bad-files-examples') | ||
|
||
it('should throw an exception if parsing fails', async () => { | ||
chai.use(chaiAsPromised) | ||
const expect = chai.expect | ||
await expect(buildEnvironmentForProject(badProjectPath, ['fileWithParseErrors.wlk'])).to.eventually.be.rejectedWith(/Failed to parse fileWithParseErrors.wlk/) | ||
}) | ||
|
||
it('should throw an exception if validation fails', async () => { | ||
const environment = await buildEnvironmentForProject(badProjectPath, ['fileWithValidationErrors.wlk']) | ||
chai.expect(() => { validateEnvironment(environment, false) }).to.throw(/Fatal error while building the environment/) | ||
}) | ||
|
||
it('should not throw an exception if validation fails but you want to skip validation', async () => { | ||
const environment = await buildEnvironmentForProject(badProjectPath, ['fileWithValidationErrors.wlk']) | ||
chai.expect(() => { validateEnvironment(environment, true) }).to.not.throw() | ||
}) | ||
|
||
}) |