Skip to content

Commit

Permalink
add promise async/await test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartolomeo Sorrentino authored and Bartolomeo Sorrentino committed May 18, 2019
1 parent 0f6da11 commit 83bc9f2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
6 changes: 6 additions & 0 deletions samples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"@types/colors": "^1.1.3",
"@types/marked": "^0.6.3",
"@types/mustache": "^0.8.30",
"@types/node": "^12.0.2",
"@types/validator": "^9.4.1",
"parcel-bundler": "^1.12.3",
"typescript": "^3.3.4000"
},
"scripts": {
"build:main": "parcel build ts/main.ts --target=node --bundle-node-modules --no-source-maps -d ./target/js",
"start:graaljs":"mvn -f graaljs-pom.xml exec:exec",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
Expand Down
34 changes: 22 additions & 12 deletions samples/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MemoryType, Optional, URI } from './j2ts/jdk8-types';

import { test as future_test } from './future.test';
import { test as marked_test } from './marked.test';
import { test as promise_test } from './promise.test';



Expand All @@ -22,18 +23,27 @@ print( Optional.of("HELLO").map( e => "element: " + e).orElse("nil") );

// TEST ENUM

print(MemoryType.HEAP);
print(MemoryType.HEAP.name());
print(MemoryType.HEAP.ordinal());
print(
`
MemoryType.HEAP = ${MemoryType.HEAP}
MemoryType.HEAP.name = ${MemoryType.HEAP.name()}
MemoryType.HEAP.ordinal = ${MemoryType.HEAP.ordinal()}
`
)

/*
color_test();
mustache_test();
validator_test();
stream_test();
*/
let async_start = async () => {

// This doesn't work on GraalJS
future_test();
/*
color_test();
mustache_test();
validator_test();
stream_test();
*/

marked_test();
future_test();
marked_test();
print( await promise_test() );
}


async_start();
10 changes: 10 additions & 0 deletions samples/ts/promise.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export async function test() {

return new Promise( (resolve, _ ) => {

resolve('WORKS');
})


}

0 comments on commit 83bc9f2

Please sign in to comment.