adding some tests
This commit is contained in:
parent
77bb781c8d
commit
8ec8f3043c
26
Makefile
26
Makefile
|
@ -2,51 +2,47 @@
|
||||||
# raco make -v --disable-inline test-analyzer.rkt
|
# raco make -v --disable-inline test-analyzer.rkt
|
||||||
# racket test-analyzer.rkt
|
# racket test-analyzer.rkt
|
||||||
|
|
||||||
launcher: last-commit-name
|
launcher:
|
||||||
raco make -v --disable-inline whalesong.rkt
|
raco make -v --disable-inline whalesong.rkt
|
||||||
racket make-launcher.rkt
|
racket make-launcher.rkt
|
||||||
|
|
||||||
whalesong: last-commit-name
|
whalesong:
|
||||||
raco make -v --disable-inline whalesong.rkt
|
raco make -v --disable-inline whalesong.rkt
|
||||||
|
|
||||||
test-all: last-commit-name
|
test-all:
|
||||||
raco make -v --disable-inline tests/test-all.rkt
|
raco make -v --disable-inline tests/test-all.rkt
|
||||||
racket tests/test-all.rkt
|
racket tests/test-all.rkt
|
||||||
|
|
||||||
test-browser-evaluate: last-commit-name
|
test-browser-evaluate:
|
||||||
raco make -v --disable-inline tests/test-browser-evaluate.rkt
|
raco make -v --disable-inline tests/test-browser-evaluate.rkt
|
||||||
racket tests/test-browser-evaluate.rkt
|
racket tests/test-browser-evaluate.rkt
|
||||||
|
|
||||||
test-compiler: last-commit-name
|
test-compiler:
|
||||||
raco make -v --disable-inline tests/test-compiler.rkt
|
raco make -v --disable-inline tests/test-compiler.rkt
|
||||||
racket tests/test-compiler.rkt
|
racket tests/test-compiler.rkt
|
||||||
|
|
||||||
|
|
||||||
test-parse-bytecode-on-collects: last-commit-name
|
test-parse-bytecode-on-collects:
|
||||||
raco make -v --disable-inline tests/test-parse-bytecode-on-collects.rkt
|
raco make -v --disable-inline tests/test-parse-bytecode-on-collects.rkt
|
||||||
racket tests/test-parse-bytecode-on-collects.rkt
|
racket tests/test-parse-bytecode-on-collects.rkt
|
||||||
|
|
||||||
|
|
||||||
test-earley: last-commit-name
|
test-earley:
|
||||||
raco make -v --disable-inline tests/test-earley.rkt
|
raco make -v --disable-inline tests/test-earley.rkt
|
||||||
racket tests/test-earley.rkt
|
racket tests/test-earley.rkt
|
||||||
|
|
||||||
|
|
||||||
test-conform: last-commit-name
|
test-conform:
|
||||||
raco make -v --disable-inline tests/test-conform.rkt
|
raco make -v --disable-inline tests/test-conform.rkt
|
||||||
racket tests/test-conform.rkt
|
racket tests/test-conform.rkt
|
||||||
|
|
||||||
test-more: last-commit-name
|
test-more:
|
||||||
raco make -v --disable-inline tests/run-more-tests.rkt
|
raco make -v --disable-inline tests/run-more-tests.rkt
|
||||||
racket tests/run-more-tests.rkt
|
racket tests/run-more-tests.rkt
|
||||||
|
|
||||||
|
doc:
|
||||||
last-commit-name:
|
|
||||||
racket make-last-commit-name.rkt
|
|
||||||
|
|
||||||
doc: last-commit-name
|
|
||||||
scribble ++xref-in setup/xref load-collections-xref --redirect-main http://docs.racket-lang.org/ --dest generated-docs --dest-name index.html scribblings/manual.scrbl
|
scribble ++xref-in setup/xref load-collections-xref --redirect-main http://docs.racket-lang.org/ --dest generated-docs --dest-name index.html scribblings/manual.scrbl
|
||||||
|
|
||||||
|
|
||||||
setup: last-commit-name
|
setup:
|
||||||
raco setup -P dyoo whalesong.plt 1 2
|
raco setup -P dyoo whalesong.plt 1 2
|
||||||
|
|
|
@ -649,6 +649,33 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'string',
|
||||||
|
baselib.arity.arityAtLeast(0),
|
||||||
|
function (MACHINE) {
|
||||||
|
var i;
|
||||||
|
var chars = [];
|
||||||
|
for (i = 0; i < MACHINE.argcount; i++) {
|
||||||
|
chars.push(checkChar(MACHINE, 'string', i).val);
|
||||||
|
};
|
||||||
|
return chars.join('');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'string->list',
|
||||||
|
1,
|
||||||
|
function (MACHINE) {
|
||||||
|
var str = checkString(MACHINE, 'string->list', 0);
|
||||||
|
var i;
|
||||||
|
var result = NULL;
|
||||||
|
for (i = 0; i < str.length; i++) {
|
||||||
|
result = makePair(baselib.chars.makeChar(elts[elts.length - 1 - i]), result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
'string-set!',
|
'string-set!',
|
||||||
|
@ -736,6 +763,19 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'string-ref',
|
||||||
|
2,
|
||||||
|
function (MACHINE) {
|
||||||
|
var firstArg = checkString(MACHINE, 'string-ref', 0).toString();
|
||||||
|
var index = baselib.numbers.toFixnum(
|
||||||
|
checkNaturalInRange(MACHINE, 'string-ref', 0,
|
||||||
|
0, firstArg.length));
|
||||||
|
return baselib.chars.makeChar(firstArg[index]);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
'string?',
|
'string?',
|
||||||
1,
|
1,
|
||||||
|
|
|
@ -340,9 +340,9 @@ memq
|
||||||
;; hash-map
|
;; hash-map
|
||||||
;; hash-for-each
|
;; hash-for-each
|
||||||
make-string
|
make-string
|
||||||
;; string
|
string
|
||||||
string-length
|
string-length
|
||||||
;; string-ref
|
string-ref
|
||||||
string=?
|
string=?
|
||||||
;; string-ci=?
|
;; string-ci=?
|
||||||
;; string<?
|
;; string<?
|
||||||
|
@ -355,7 +355,7 @@ memq
|
||||||
;; string-ci>=?
|
;; string-ci>=?
|
||||||
substring
|
substring
|
||||||
string-append
|
string-append
|
||||||
;; string->list
|
string->list
|
||||||
list->string
|
list->string
|
||||||
;; string-copy
|
;; string-copy
|
||||||
string->symbol
|
string->symbol
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#lang racket/base
|
|
||||||
|
|
||||||
(require racket/runtime-path)
|
|
||||||
(define-runtime-path git-head-path ".git/refs/heads/master")
|
|
||||||
(define-runtime-path last-commit-name.rkt "last-commit-name.rkt")
|
|
||||||
|
|
||||||
(call-with-input-file git-head-path
|
|
||||||
(lambda (ip)
|
|
||||||
(call-with-output-file last-commit-name.rkt
|
|
||||||
(lambda (op)
|
|
||||||
(fprintf op "#lang racket/base
|
|
||||||
|
|
||||||
;; This file is automatically generated by make-last-commit-name.rkt.
|
|
||||||
;; Do not edit this file by hand.
|
|
||||||
|
|
||||||
(provide (all-defined-out))
|
|
||||||
(define git-head ~s)
|
|
||||||
"
|
|
||||||
(read-line ip)))
|
|
||||||
#:exists 'replace)))
|
|
|
@ -15,6 +15,10 @@
|
||||||
;;
|
;;
|
||||||
(define-syntax (define-resource stx)
|
(define-syntax (define-resource stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
|
[(_ name:id)
|
||||||
|
(with-syntax ([path (symbol->string #'name)])
|
||||||
|
(syntax/loc stx
|
||||||
|
(define-resource name path)))]
|
||||||
[(_ name:id path:str)
|
[(_ name:id path:str)
|
||||||
(let* ([normal-path
|
(let* ([normal-path
|
||||||
(normalize-path (build-path
|
(normalize-path (build-path
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
planet/resolver
|
planet/resolver
|
||||||
scribble/eval
|
scribble/eval
|
||||||
racket/sandbox
|
racket/sandbox
|
||||||
|
racket/port
|
||||||
(only-in racket/contract any/c)
|
(only-in racket/contract any/c)
|
||||||
racket/runtime-path
|
racket/runtime-path
|
||||||
"scribble-helpers.rkt"
|
"scribble-helpers.rkt"
|
||||||
"../last-commit-name.rkt"
|
|
||||||
"../js-assembler/get-js-vm-implemented-primitives.rkt")
|
"../js-assembler/get-js-vm-implemented-primitives.rkt")
|
||||||
|
|
||||||
|
@(require racket/runtime-path)
|
||||||
|
@(define-runtime-path git-head-path "../.git/refs/heads/master")
|
||||||
|
|
||||||
|
|
||||||
@(require (for-label (this-package-in js))
|
@(require (for-label (this-package-in js))
|
||||||
(for-label (this-package-in lang/base))
|
(for-label (this-package-in lang/base))
|
||||||
(for-label (this-package-in resource)))
|
(for-label (this-package-in resource)))
|
||||||
|
@ -54,7 +58,10 @@
|
||||||
@url{https://github.com/dyoo/whalesong}. The latest version of this
|
@url{https://github.com/dyoo/whalesong}. The latest version of this
|
||||||
document lives in @url{http://hashcollision.org/whalesong}.}}
|
document lives in @url{http://hashcollision.org/whalesong}.}}
|
||||||
|
|
||||||
@centered{@smaller{Current commit head is @tt{@git-head}.}}
|
@(if (file-exists? git-head-path)
|
||||||
|
(let ([git-head (call-with-input-file git-head-path port->string)])
|
||||||
|
@centered{@smaller{Current commit head is @tt{@git-head}.}})
|
||||||
|
"")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -442,7 +449,7 @@ get-javascript depend on.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@section{Including external resources with @racketmodname/this-package[resource]}
|
@section{Including external resources}
|
||||||
@defmodule/this-package[resource]
|
@defmodule/this-package[resource]
|
||||||
|
|
||||||
Programs may need to use external file resources that aren't
|
Programs may need to use external file resources that aren't
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
scriblib/render-cond)
|
scriblib/render-cond)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Adds JavaScript if we're rendering in HTML.
|
;; Adds JavaScript if we're rendering in HTML.
|
||||||
(define (inject-javascript-inline . body)
|
(define (inject-javascript-inline . body)
|
||||||
(cond-element
|
(cond-element
|
||||||
|
|
|
@ -13,3 +13,12 @@
|
||||||
"lo"
|
"lo"
|
||||||
""
|
""
|
||||||
"hello"
|
"hello"
|
||||||
|
""
|
||||||
|
"abc"
|
||||||
|
#\h
|
||||||
|
#\e
|
||||||
|
#\l
|
||||||
|
#\o
|
||||||
|
(list #\x #\y #\z)
|
||||||
|
(list #\x)
|
||||||
|
(list)
|
||||||
|
|
|
@ -17,3 +17,16 @@
|
||||||
|
|
||||||
(list->string '())
|
(list->string '())
|
||||||
(list->string '(#\h #\e #\l #\l #\o))
|
(list->string '(#\h #\e #\l #\l #\o))
|
||||||
|
|
||||||
|
|
||||||
|
(string)
|
||||||
|
(string #\a #\b #\c)
|
||||||
|
|
||||||
|
(string-ref "hello" 0)
|
||||||
|
(string-ref "hello" 1)
|
||||||
|
(string-ref "hello" 2)
|
||||||
|
(string-ref "hello" 4)
|
||||||
|
|
||||||
|
(string->list "xyz")
|
||||||
|
(string->list "x")
|
||||||
|
(string->list "")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user