Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#134 - Test all binary expression compiler #170

Merged

Conversation

davemneo
Copy link
Contributor

@davemneo davemneo commented May 25, 2018

Requirements

Create tests for all BinaryExpressions in BinaryExpressionCompiler.js

Description of the Change

In BinaryExpressionCompiler.test.js:
Added tests for all binary expressions.
Features that are not supported are skipped

Added tests for all Binary Expressions.
In BinaryExpressionCompiler.js:
Variations of an expression or default cases that are not tested are marked with a "Not Tested" comment.

Test Plan

These are the unit tests.

Alternate Designs

None, followed existing pattern for tests.

Benefits

Most all variations of binary expressions are covered.

Possible Drawbacks

More tests results in longer test times.

Applicable Issues

Created Issue#170 for EqualsEqualsToken
This resolves Issue #134

 - Removed an unused import of: ParameterDeclaration

Resolve neo-one-suite#144

BinaryExpressionCompiler.ts
 Added code for instanceOf

BinaryExpressionCompiler.ts
 Added test for instanceof
In BinaryExpressionCompiler.test.js:
 Added labels for tests for easy mapping to tested feature
 Added tests for all current BinaryExpressions in BinaryExpressionCompiler.js
 - Skipped failing tests for unsupported or features with bugs EqualsEqualsKeyword (Issue neo-one-suite#170)
 Adjusted indenting for all tests to be the same

In BinaryExpressionCompiler.js:
 Added Comments describing tested or not tested
…ll_BinaryExpressionCompiler

adding files that were not added in last commit
if (4 / 2 !== 2) {
throw 'Failure';
}
if (! ((128 >> 2) == 32) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove the extra space after !

Copy link
Contributor

Choose a reason for hiding this comment

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

here and throughout the file


test('(6 & 5) === 4 [AmpersandToken]', async () => {
await helpers.executeString(`
if (!(6 & 5) === 4) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to add parentheses: !((6 & 5) === 4). Makes it clearer anyways. Or just use !==.

`);
});

test('(127 ^ -6) === -123 [CaretToken]', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is failing in CI.


test('! (0 === null) [EqualsEqualsEqualsToken]', async () => {
await helpers.executeString(`
if (0 === null ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra space before )


test('0 === false [EqualsEqualsEqualsToken]', async () => {
await helpers.executeString(`
if ( 0 === false ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra spacing in parentheses

@@ -91,9 +91,11 @@ export default class BinaryExpressionCompiler extends NodeCompiler<
const pushValueOptions = sb.pushValueOptions(options);
switch (kind) {
case SyntaxKind.EqualsToken:
// Tested
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a huge fan of these comments, but since we can't really get code coverage reports it's probably better to leave them in.

@dicarlo2 dicarlo2 merged commit 9064916 into neo-one-suite:master Jun 9, 2018
@davemneo davemneo deleted the test_all_BinaryExpressionCompiler branch July 9, 2018 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants