-
Notifications
You must be signed in to change notification settings - Fork 28
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
ECMA 6 - Constants and variables and Map/Set tests #139
Merged
+143
−1
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
aa35bfd
First ECMAScript 6 tests
pemattio 1aa7ed6
Solved: Expected indentation of 4 spaces but found 1 tab indent
pemattio eb3b6b9
More Map tests
pemattio 98d9d7f
Indentation fixed
pemattio 8d66543
indent
pemattio 2f4d0f6
Merge branch 'master' into pemattio/ecma6-tests
pemattio a2ff030
Tabs a espacios
pemattio 15c5c4d
Fixed indentation constants and variables & map and set
pemattio eca7531
Added result.success to ECMA 6 first tests
pemattio 3f5931d
Added set tests and corrections
pemattio 43ad55e
Minimal indentation fix
Undre4m ffc3d72
Minimal indentation fix
Undre4m 07be676
Merge branch 'master' into pemattio/ecma6-tests
Undre4m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
69 changes: 69 additions & 0 deletions
69
test/suites/ecma6-tests/ecma6-constants-and-variables-tests.js
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,69 @@ | ||
// Copyright (c) 2013 - present UTN-LIS | ||
|
||
/* eslint quotes: 0, no-unused-vars: 0 */ | ||
|
||
/** | ||
* PUMASCRIPT ECMA 6 CONSTANTS AND VARIABLES SUITE | ||
* @file: Ecma6 Constants and variables expressions test suite for the language | ||
*/ | ||
var test = QUnit.test; | ||
var skip = QUnit.skip; | ||
|
||
define(['pumascript'], function (puma) { | ||
|
||
QUnit.module("Ecma6-Constants-And-Variables-Tests"); | ||
|
||
skip("Constant", function(assert) { | ||
var result = puma.evalPuma("const PI = 3.141593; PI;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 3.141593); | ||
}); | ||
|
||
skip("Constant principal scope", function(assert) { | ||
var result = puma.evalPuma("const PI = 3.141593; if(true){const PI = 3.14;} PI;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 3.141593); | ||
}); | ||
|
||
skip("Constant block scope", function(assert) { | ||
var result = puma.evalPuma("const PI = 3.141593; if(true){const PI = 3.14; PI}"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 3.14); | ||
}); | ||
|
||
skip("Constant principal scope not defined with block scope constant", function(assert) { | ||
var result = puma.evalPuma("if(true){const PI = 3.141593;} typeof(PI);"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 'undefined'); | ||
}); | ||
|
||
skip("Change of a property from a constant as an object", function(assert) { | ||
var result = puma.evalPuma("const p = {first: 'john', last: 'smith'}; p.first = 'bob'; p.first;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 'bob'); | ||
}); | ||
|
||
skip("Variable let", function(assert) { | ||
var result = puma.evalPuma("let a = 2; a;"); | ||
assert.ok(result.success && result.value === 2); | ||
}); | ||
|
||
skip("Variable let principal scope", function(assert) { | ||
var result = puma.evalPuma("let a = 2; if(true){let a = 3;} a;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 2); | ||
}); | ||
|
||
skip("Variable let block scope", function(assert) { | ||
var result = puma.evalPuma("let a = 2; if(true){let a = 3; a;}"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 3); | ||
}); | ||
|
||
skip("Variable let principal scope not defined with block scope constant", function(assert) { | ||
var result = puma.evalPuma("if(true){let a = 3;} typeof(a);"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 'undefined'); | ||
}); | ||
|
||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add blank line at EOF |
59 changes: 59 additions & 0 deletions
59
test/suites/ecma6-tests/ecma6-map-set-and-weakmap-weakset-tests.js
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,59 @@ | ||
// Copyright (c) 2013 - present UTN-LIS | ||
|
||
/* eslint quotes: 0, no-unused-vars: 0 */ | ||
|
||
/** | ||
* PUMASCRIPT ECMA 6 MAP-SET AND WEAKMAP-WEAKSET SUITE | ||
* @file: Ecma6 Map-Set and WeakMap-WeakSet expressions test suite for the language | ||
*/ | ||
var test = QUnit.test; | ||
var skip = QUnit.skip; | ||
|
||
define(['pumascript'], function (puma) { | ||
|
||
QUnit.module("Ecma6-Map-Set-And-WeakMap-WeakSet-Tests"); | ||
|
||
skip("Map get method", function(assert) { | ||
var result = puma.evalPuma("let m = new Map(); let s = Symbol(); m.set('hello', 42); m.set(s, 34); m.get(s);"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 34); | ||
}); | ||
|
||
skip("Map has method", function(assert) { | ||
var result = puma.evalPuma("let m = new Map(); let s = Symbol(); m.set('hello', 42); m.set(s, 34); m.has(s);"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === true); | ||
}); | ||
|
||
skip("Map stores unique keys, check of size", function(assert) { | ||
var result = puma.evalPuma("let m = new Map(); let s = Symbol(); m.set('hello', 42); m.set(s, 34); m.set('hello', 34); m.size;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 2); | ||
}); | ||
|
||
skip("Map delete method", function(assert) { | ||
var result = puma.evalPuma("let m = new Map(); let s = Symbol(); m.set('hello', 42); m.set(s, 34); m.delete('hello'); m.size;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 1); | ||
}); | ||
|
||
skip("Map clear method", function(assert) { | ||
var result = puma.evalPuma("let m = new Map(); let s = Symbol(); m.set('hello', 42); m.set(s, 34); m.clear(); m.size;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 0); | ||
}); | ||
|
||
skip("Set has method", function(assert) { | ||
var result = puma.evalPuma("let s = new Set(); s.add('hello'); s.has('hello');"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === true); | ||
}); | ||
|
||
skip("Set stores unique values, check of size", function(assert) { | ||
var result = puma.evalPuma("let s = new Set(); s.add('hello').add('goodbye').add('hello'); s.size;"); | ||
result.makeValue(); | ||
assert.ok(result.success && result.value === 2); | ||
}); | ||
|
||
//Missing WeakMap and WeakSet tests | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review indentation. Please take note of unsupported cases for Puma. This will help to define future tasks on the runtime support.