Adding testing
This commit is contained in:
@@ -60,7 +60,7 @@ function Theme (_default) {
|
||||
e.stopPropagation()
|
||||
const file = e.dataTransfer.files[0]
|
||||
if (!file || !file.name) { console.warn('Theme', 'Unnamed file.'); return }
|
||||
if (file.name.indexOf('.thm') < 0 && file.name.indexOf('.svg') < 0) { console.warn('Theme', 'Skipped, not a theme'); return }
|
||||
if (file.name.indexOf('.thm') < 0 && file.name.indexOf('.svg') < 0) { return }
|
||||
const reader = new FileReader()
|
||||
reader.onload = function (e) {
|
||||
themer.load(e.target.result)
|
||||
|
||||
@@ -131,11 +131,6 @@ function Library (ronin) {
|
||||
return rect
|
||||
}
|
||||
|
||||
this.echo = function (any) {
|
||||
console.log(any)
|
||||
return any
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
this.of = function (h, k) {
|
||||
@@ -155,7 +150,7 @@ function Library (ronin) {
|
||||
this.mul = function (...args) {
|
||||
return args.reduce((sum, val) => sum * val)
|
||||
}
|
||||
|
||||
|
||||
this.div = function (...args) {
|
||||
return args.reduce((sum, val) => sum / val)
|
||||
}
|
||||
@@ -171,4 +166,20 @@ function Library (ronin) {
|
||||
this.step = function (val, step) {
|
||||
return Math.round(val / step) * step
|
||||
}
|
||||
|
||||
// Generics
|
||||
|
||||
this.echo = function (...args) {
|
||||
console.log(args.reduce((acc, val) => { return acc + val + ' ' }, ''))
|
||||
return args
|
||||
}
|
||||
|
||||
this.test = function (name, a, b) {
|
||||
if (a !== b) {
|
||||
console.warn('failed ' + name, a, b)
|
||||
} else {
|
||||
console.log('passed ' + name, a, b)
|
||||
}
|
||||
return a === b
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ function Lisp (input, lib) {
|
||||
run: (input, context) => {
|
||||
const file = fs.readFileSync(
|
||||
path.resolve(input[1].value),
|
||||
{encoding: "utf-8"})
|
||||
{ encoding: 'utf-8' })
|
||||
|
||||
return interpret(this.parse(file), context)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user