Skip to content

Conversation

@ning-y
Copy link
Member

@ning-y ning-y commented May 23, 2018

This PR depends on #24 as it uses the convenience function isBool and test file src/slang/utils/__tests__rttc.ts.


Summary

  • In the programs a ? b : c; or if (a) { 1; } else { 0; }, a must be a boolean value, or a error is raised, and the program is stopped.

Issues fixed

@ning-y ning-y added Bug Something isn't working slang blocked Something else needs pass review first labels May 23, 2018
@ning-y ning-y added this to the Sprint 1 milestone May 23, 2018
@ning-y ning-y requested a review from evansb May 24, 2018 04:11
const operatorValues = [num, str, func]
const context = mockRuntimeContext()
const errors = operatorValues.map(opVal => rttc.checkIfStatement(context, opVal))
errors.map(error => expect(error).toBeDefined())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make this check if error is instance of TypeError

@evansb evansb mentioned this pull request May 26, 2018
1 task
@ning-y ning-y merged commit 531f93c into fix-typings May 26, 2018
ning-y added a commit that referenced this pull request May 26, 2018
1. Had to make changes to src/mocks/context.ts in order to for the mock Closure
   to use the Closure constructor (our own typeOf uses typeof, which checks the
   constructor to determine object types).
2. To get 100% test coverage, there was a need to call the elaborate method of
   TypeError. Went ahead and replaced that with explain() since it's probably
   better than 'TODO'.
3. Best way to test the error messages was with snapshots, IMO.

Resolves #29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Something else needs pass review first Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants