Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into ESLint&CodeRefactor.
Browse files Browse the repository at this point in the history
Removed jshint old global directives.
  • Loading branch information
Undre4m committed Oct 12, 2017
2 parents fe4cefe + 0db66a9 commit fcfa58c
Show file tree
Hide file tree
Showing 20 changed files with 126 additions and 144 deletions.
2 changes: 0 additions & 2 deletions src/global.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define, global */

define([], function () {
var Global = {};

Expand Down
2 changes: 0 additions & 2 deletions src/prune-pass.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define */

define([], function () {

/**
Expand Down
2 changes: 0 additions & 2 deletions src/pumascript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define, require */

require.config({
paths: {
'esprima': '../thirdparty/esprima/esprima',
Expand Down
6 changes: 3 additions & 3 deletions src/runtime.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define, console */
/*
PumaScript main source code
/**
* @file: PumaScript main source code
*/

define([
'escodegen',
'esprima',
Expand Down
2 changes: 0 additions & 2 deletions src/state.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define, console */

define([
'../src/global',
'../src/symbols/symbol',
Expand Down
2 changes: 0 additions & 2 deletions src/symbols/function-symbol.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define */

define([
'./symbol'
], function (Symbol) {
Expand Down
2 changes: 0 additions & 2 deletions src/symbols/property-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define */

define([
'./symbol'
], function (Symbol) {
Expand Down
2 changes: 0 additions & 2 deletions src/symbols/symbol.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2013 - present UTN-LIS

/*global define, console */

define([], function () {

/**
Expand Down
26 changes: 12 additions & 14 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) 2013 - present UTN-LIS

/*global require, QUnit */

/*
* PUMASCRIPT MAIN ENTRY FILE FOR TEST
* @file: file that includes the dependencies and executions fof RequireJS.
/**
* PUMASCRIPT MAIN ENTRY FILE FOR TEST
* @file: file that includes the dependencies and executions fof RequireJS.
*/

require.config({
Expand All @@ -22,17 +20,17 @@ var suites = [
'./suites/base-tests.js',
'./suites/runtime-tests.js',
'./suites/integration-tests.js',
'./suites/Tests-7-ECMA.js',
'./suites/Tests-8-ECMA.js',
'./suites/Tests-9-ECMA.js',
'./suites/Tests-10-ECMA.js',
'./suites/Tests-11-ECMA.js',
'./suites/Tests-12-ECMA.js',
'./suites/Tests-13-ECMA.js',
'./suites/Tests-15-ECMA.js'
'./suites/ecma-lexical-conventions-test.js',
'./suites/ecma-type-test.js',
'./suites/ecma-type-conversion-and-testing.js',
'./suites/ecma-executable-code-and-execution-contexts-test.js',
'./suites/ecma-expressions-test.js',
'./suites/ecma-statements-test.js',
'./suites/ecma-function-definition-test.js',
'./suites/ecma-standard-built-in-ecmascript-objects-test.js'
];

require(suites, function () {
// Required to make it work under phantomjs environment
QUnit.start();
});
});
4 changes: 2 additions & 2 deletions test/suites/base-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint quotes: 0, no-unused-vars: 0 */

/**
* PUMASCRIPT BASE TEST SUITE
* @file: Base expressions test suite for the language
* PUMASCRIPT BASE TEST SUITE
* @file: Base expressions test suite for the language
*/
define(['pumascript', 'esprima'], function(puma, esprima) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint quotes: 0 */

/**
* PUMASCRIPT ECMA-10 TEST SUITE
* @file: Executable Code and Execution Contexts Test Suite
* PUMASCRIPT ECMA-10 TEST SUITE
* @file: Executable Code and Execution Contexts Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint quotes: 0 */

/**
* PUMASCRIPT ECMA-11 TEST SUITE
* @file: Expressions Test Suite
* PUMASCRIPT ECMA-11 TEST SUITE
* @file: Expressions Test Suite
*/
define(['pumascript', 'esprima'], function(puma, esprima) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,96 +1,94 @@
// Copyright (c) 2013 - present UTN-LIS

/* eslint quotes: 0, no-unused-vars: 0 */

/**
* PUMASCRIPT ECMA-13 TEST SUITE
* @file: Function Definition Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {


module("13 Function Definition");

test("function definiton 1", function () {
var result = puma.evalPuma("function testA (a) {return a}; var test = testA('a1'); test");
result.makeValue();
equal(result.value, 'a1', "Passed!");
});
test("function definiton 2", function () {
var result = puma.evalPuma("function testA (a, b, c) {return {letterA: a, letterB:b, letterC : c}}; var test = testA('z', 'x', 'y'); test.letterA;");
result.makeValue();
equal(result.value, "z", "Passed!");
});

module("13.1 Strict Mode Restrictions");

test("Strict Mode Restriction 1", function () {
var errorMessage;
try {
var result = puma.evalPuma("\"use strict\"; var o = { p: 1, p: 2 };");
} catch (err) {
errorMessage = err.message;
}
equal(errorMessage, "Line 1: Duplicate data property in object literal not allowed in strict mode", "Passed!");
});

test("Strict Mode Restriction 2", function () {
var errorMessage;
try {
var result = puma.evalPuma("\"use strict\";(function (eval){})");
} catch (err) {
errorMessage = err.message;
}
equal(errorMessage, "Line 1: Parameter name eval or arguments is not allowed in strict mode", "Passed!");
});

test("Strict Mode Restriction 3", function () {
var errorMessage;
try {
var result = puma.evalPuma("(function eval(){'use strict';})");
} catch (err) {
errorMessage = err.message;
}
equal(errorMessage, "Line 1: Function name may not be eval or arguments in strict mode", "Passed!");
});

module("13.2 Creating Function Objects");

test("Creating Function Objects", function () {
var result = puma.evalPuma("var F = function Add(x,y){return x+y}; F(2,3)");
result.makeValue();
equal(result.value, '5', "Passed!");
});

test("Creating Function Objects 2", function () {
var result = puma.evalPuma("function add (x, y) {return x+y;}var sum = add(2,3);sum;");
result.makeValue();
equal(result.value, '5', "Passed!");
});

QUnit.skip("Creates a function and uses prototype method", function () {
var result = puma.evalPuma("function operations (x,y) {this.x = x; this.y = y;} operations.prototype.mul = function () {return this.x*this.y;};var op = new operations(2,3); op.mul();");
result.makeValue();
equal(result.value, 6, "Passed!");
});


QUnit.skip("Creates a function and gets its internal value with a getter function", function () {
var result = puma.evalPuma("function operations(x) {this._x = x;}Object.defineProperty(operations.prototype, 'x', {get: function () {return this._x;}});var op = new operations(2);op.x;");
result.makeValue();
equal(result.value, 2, "Passed!");
});

QUnit.skip("Creates a function and calls its internal method", function () {
var result = puma.evalPuma("function Square (side) {this.side = side;this.area = function () {return this.side * this.side;}}var s1 = new Square(2);s1.area();");
equal(result.value, '4', "Passed!");
});

test("Function Object creation", function () {
var result = puma.evalPuma("var test = {};test;");
result.makeValue();
equal(typeof result.value, "object", "Passed!");
});


});
// Copyright (c) 2013 - present UTN-LIS

/* eslint quotes: 0, no-unused-vars: 0 */

/**
* PUMASCRIPT ECMA-13 TEST SUITE
* @file: Function Definition Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {


module("13 Function Definition");

test("function definiton 1", function () {
var result = puma.evalPuma("function testA (a) {return a}; var test = testA('a1'); test");
result.makeValue();
equal(result.value, 'a1', "Passed!");
});
test("function definiton 2", function () {
var result = puma.evalPuma("function testA (a, b, c) {return {letterA: a, letterB:b, letterC : c}}; var test = testA('z', 'x', 'y'); test.letterA;");
result.makeValue();
equal(result.value, "z", "Passed!");
});

module("13.1 Strict Mode Restrictions");

test("Strict Mode Restriction 1", function () {
var errorMessage;
try {
var result = puma.evalPuma("\"use strict\"; var o = { p: 1, p: 2 };");
} catch (err) {
errorMessage = err.message;
}
equal(errorMessage, "Line 1: Duplicate data property in object literal not allowed in strict mode", "Passed!");
});

test("Strict Mode Restriction 2", function () {
var errorMessage;
try {
var result = puma.evalPuma("\"use strict\";(function (eval){})");
} catch (err) {
errorMessage = err.message;
}
equal(errorMessage, "Line 1: Parameter name eval or arguments is not allowed in strict mode", "Passed!");
});

test("Strict Mode Restriction 3", function () {
var errorMessage;
try {
var result = puma.evalPuma("(function eval(){'use strict';})");
} catch (err) {
errorMessage = err.message;
}
equal(errorMessage, "Line 1: Function name may not be eval or arguments in strict mode", "Passed!");
});

module("13.2 Creating Function Objects");

test("Creating Function Objects", function () {
var result = puma.evalPuma("var F = function Add(x,y){return x+y}; F(2,3)");
result.makeValue();
equal(result.value, '5', "Passed!");
});

test("Creating Function Objects 2", function () {
var result = puma.evalPuma("function add (x, y) {return x+y;}var sum = add(2,3);sum;");
result.makeValue();
equal(result.value, '5', "Passed!");
});

QUnit.skip("Creates a function and uses prototype method", function () {
var result = puma.evalPuma("function operations (x,y) {this.x = x; this.y = y;} operations.prototype.mul = function () {return this.x*this.y;};var op = new operations(2,3); op.mul();");
result.makeValue();
equal(result.value, 6, "Passed!");
});


QUnit.skip("Creates a function and gets its internal value with a getter function", function () {
var result = puma.evalPuma("function operations(x) {this._x = x;}Object.defineProperty(operations.prototype, 'x', {get: function () {return this._x;}});var op = new operations(2);op.x;");
result.makeValue();
equal(result.value, 2, "Passed!");
});

QUnit.skip("Creates a function and calls its internal method", function () {
var result = puma.evalPuma("function Square (side) {this.side = side;this.area = function () {return this.side * this.side;}}var s1 = new Square(2);s1.area();");
equal(result.value, '4', "Passed!");
});

test("Function Object creation", function () {
var result = puma.evalPuma("var test = {};test;");
result.makeValue();
equal(typeof result.value, "object", "Passed!");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* PUMASCRIPT ECMA-7 TEST SUITE
* @file: Lexical Conventions Test Suite
* @file: Lexical Conventions Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {
module("7.2 White space");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* PUMASCRIPT ECMA-15 TEST SUITE
* @file: Standard Built-in ECMAScript Objects
* @file: Standard Built-in ECMAScript Objects
*/
define(['pumascript', 'esprima'], function (puma, esprima) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint quotes: 0, no-unused-vars: 0 */

/**
* PUMASCRIPT ECMA-12 TEST SUITE
* @file: Statements Test Suite
* PUMASCRIPT ECMA-12 TEST SUITE
* @file: Statements Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* PUMASCRIPT ECMA-9 TEST SUITE
* @file: Type Conversion and Testing Test Suite
* @file: Type Conversion and Testing Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {

Expand Down
4 changes: 2 additions & 2 deletions test/suites/Tests-8-ECMA.js → test/suites/ecma-type-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint quotes: 0 */

/**
* PUMASCRIPT ECMA-8 TEST SUITE
* @file: Types Test Suite
* PUMASCRIPT ECMA-8 TEST SUITE
* @file: Types Test Suite
*/
define(['pumascript', 'esprima'], function (puma, esprima) {

Expand Down
4 changes: 2 additions & 2 deletions test/suites/integration-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint quotes: 0, no-unused-vars: 0 */

/**
* PUMASCRIPT INTEGRATION TEST SUITE
* @file: Integration test suite including complex and real applications of puma
* PUMASCRIPT INTEGRATION TEST SUITE
* @file: Integration test suite including complex and real applications of puma
*/
define(['pumascript', 'esprima'], function(puma, esprima) {

Expand Down
Loading

0 comments on commit fcfa58c

Please sign in to comment.