Closed winksaville closed 7 years ago
I figured out the version problem, I needed to recompile addTwo.tbs. Which I did so using:
$ chmod a+x ./bin/tc
$ ./bin/tc ./tests/addTwo.tbs --wasm --out ./tests/addTwo.wasm
TURBO_PATH:/home/wink/prgs/TurboScript.myfork
pre-parsing: 2.686ms
lexing: 35.232ms
preprocessing: 0.121ms
parsing: 11.079ms
checking: 23.554ms
shaking: 0.674ms
emitting: 17.892ms
Done!
$ cp tests/addTwo.wasm tests/reference/addTwo.wasm
But now I have a new problem, the browser doesn't see either reference to addTwo as a function:
TurboScript WASM
addTwo.html:21 ----------------
addTwo.html:37 Reference WASM
addTwo.html:38 ----------------
addTwo.html:22 Uncaught (in promise) TypeError: mod.exports.addTwo is not a function
at addTwo.html:22
(anonymous) @ addTwo.html:22
addTwo.html:39 Uncaught (in promise) TypeError: modRef.exports.addTwo is not a function
at addTwo.html:39
So again I ask; What am I doing Wrong?
Most of the tests are broken with latest changes. I'll fix it tomorrow.
Also there is no more reference WASM files since wasm emitter is stable now.
If you give me a clue I'd like to try to fix addTwo.
On Tue, Mar 28, 2017, 2:03 PM Nidin Vinayakan notifications@github.com wrote:
Also there is no more reference WASM files since wasm emitter is stable now.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/01alchemist/TurboScript/issues/25#issuecomment-289904088, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-hHIvcAbWe86VgBJNyhC8Cv76f3RuCks5rqXWZgaJpZM4MsDgr .
In master i already fixed addTwo, please look in to source and use the same export function names in html page. there is a file make.js
just run node make.js
it should build tests and copy binary to tests/bin
. in make.js i added only few test files. you may add all tests but it might broke.
The make node.js
didn't work for me:
wink@wink-envy:~/prgs/TurboScript.myfork/tests (master)
$ node make.js
Compiling ASM.JS tests...
Compiling WASM tests...
Object "addTwo.tbs" is unknown, try "tc help".
Object "array.tbs" is unknown, try "tc help".
Object "binary.tbs" is unknown, try "tc help".
Object "block.tbs" is unknown, try "tc help".
Object "addTwo.tbs" is unknown, try "tc help".
Object "array.tbs" is unknown, try "tc help".
Object "binary.tbs" is unknown, try "tc help".
Object "block.tbs" is unknown, try "tc help".
block.tbs failed to compile
binary.tbs failed to compile
array.tbs failed to compile
addTwo.tbs failed to compile
block.tbs failed to compile
binary.tbs failed to compile
array.tbs failed to compile
addTwo.tbs failed to compile
So I tweaked my add-server branch and its now working for addTwo-wasm. You first do npm run test:build
and then start the server with npm run server
. Finally, something like google-chrome-stable http://localhost:3000/tests/addTwo-wasm.html
and looking at the console output and addTwo-wasm.html now worked as expected, THANKS.
So I'm interested maybe doing some tests, but want to know what your goals are.
Do you want browser based tests or nodejs based tests, my own thoughts would be to start with nodejs only?
I'm not really interested in asm.js, long term it seems a dead en, and would like to just test wasm, what do you think?
Disclosure: I'm a retired programmer with lots of experience in C/C++/Java but I'm just learning web development so I'm looking for constructive feed back and opportunities to learn.
Hi @winksaville, Nice work. The goal is to target both browser and node.js. for now we can start with node.js only since TurboScript cannot access DOM or any browser API and scope for the v1 is support all WASM MVP features. No GC, No DOM access, basic interoperability with external JS.
I am also not interested in supporting asm.js for long term. asm.js currently support shared memory but WASM doesn't therefore asm.js is a valuable target to test parallel programming features of TurboScript till WASM shared memory spec ready.
Your knowledge is very valuable to mature this project. I will come up with more ideas to discuss. If you are interested in integrating any testing frameworks like karma or Jest you may check this issues/19 Just create a pull request when you are done.
Happy web development 👍
SG, I'll work up a PR and we'll see where it goes.
@winksaville make.js script patched for portability and added a task in package.json use npm run test:build
could you please pull latest changes from master.
I've created a change which adds a server to be used with tests. But I'm getting in the Browser:
Here are versions of my system
What am I doing wrong?