Skip to content

Instantly share code, notes, and snippets.

/**
* @name: S8.7.2_A3_T1;
* @section: 8.7.2;
* @assertion: x = 1 calls PutValue(V,W) setting the new value of V
* @description: Execute x = 1, that calls PutValue(V,W) where V is an unresolved
* reference in a strict mode scope.
* A ReferenceError should be throw
*/
"use strict"
var str = "";
var strObj_ = new String();
////////////////////////////////////////////////////////////
// CHECK#6
if (str === strObj_){
$ERROR('#6: objects of str=""; and strObj=new String(); are not equal');
}
#lang racket/base
(require racket/match)
;; ------------------------------------- Define booleans
(define the-false-value #f)
;; ------------------------------------- Data Types Predicates.
(define (boolean? x )
(or (eq? x the-false-value) (eq? x (not the-false-value)) ))
@pedrodelgallego
pedrodelgallego / evaluator-test.scm
Created July 28, 2010 08:07
A Scheme intrepreter that allow you to run top level programs.
#lang racket/base
(require rackunit "kernel.rkt")
(define (test description test-case result)
(display ".")
(check-equal? (evaluate test-case) result description))
;; Test Simple data types.
(test "the false value" #f #f)
if (isNaN(parseInt("\u000B")) !== true) {
print('parseInt("\\u000B") === Not-a-Number. Actual: ' + (parseInt("\u000B")));
}
// CHECK#5
if (!(isFinite("string") === false)) {
$ERROR('#5: "string" === Not-a-Finite. Actual: ' + ("string"));
}
// CHECK#1
if (!(isFinite({}) === false)) {
$ERROR('#1: {} === Not-a-Finite. Actual: ' + ({}));
}
Array.prototype[1] = 1;
var x = [0];
x.length = 2;
var arr = x.concat();
//CHECK#1
if (arr[0] !== 0) {
$ERROR('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; var arr = x.concat(); arr[0] === 0. Actual: ' + (arr[0]));
}
var obj = {};
obj.push = Array.prototype.push;
obj.length = 4294967295;
//CHECK#1
var push = obj.push("x", "y", "z");
if (push !== 4294967298) {
$ERROR('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z") === 4294967298. Actual: ' + (push));
}
//CHECK#1
try {
var x = [];
x.length = NaN;
$ERROR('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) {
if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: x = []; x.length = NaN throw RangeError. Actual: ' + (e));
}
}
"use strict"
var __obj = {
valueOf:function(){},
toString:void 0
};
var __split = new String(__obj).split(function(){}());
if (__split.length !== 2) {