File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ function compileProject(
173173 const watFile = path . relative ( baseDir , path . join ( outDir , name + ".wat" ) ) ;
174174 const wasmFile = path . relative ( baseDir , path . join ( outDir , name + ".wasm" ) ) ;
175175
176- if ( args . wat && ( args . outDir && ! ( hasOutput ( ascArgv , ".wat" ) || config . options ?. textFile ) ) ) {
176+ if ( args . wat && ( ! ( hasOutput ( ascArgv , ".wat" ) || config . options ?. textFile ) ) ) {
177177 ascArgv . push ( "--textFile" , watFile ) ;
178178 }
179179 if ( args . outDir || ! ( hasOutput ( ascArgv , ".wasm" ) || ( config . options ?. binaryFile ) ) ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as path from "path";
44import * as fs from "fs" ;
55
66let binary : Uint8Array ;
7+ let textFile : string ;
78let stderr : string ;
89
910let args = process . argv . slice ( 2 ) ;
@@ -19,6 +20,8 @@ main(args, {
1920 mapFiles . set ( name , contents ) ;
2021 if ( name . endsWith ( ".wasm" ) ) {
2122 binary = contents ;
23+ } else if ( name . endsWith ( ".wat" ) ) {
24+ textFile = contents ;
2225 }
2326 } ,
2427 stderr : {
@@ -37,6 +40,7 @@ main(args, {
3740 const jsonPath = path . join ( process . cwd ( ) , "expected.json" ) ;
3841 if ( fs . existsSync ( jsonPath ) && stderr ) {
3942 const actual = JSON . parse ( stderr ) . options ;
43+ console . log ( actual )
4044 const expected = require ( jsonPath ) ;
4145 let errored = false ;
4246 for ( let name of Object . getOwnPropertyNames ( expected ) ) {
@@ -65,7 +69,7 @@ main(args, {
6569 }
6670
6771
68- if ( ! binary ) {
72+ if ( ! binary && ! textFile ) {
6973 console . error ( "No binary was generated for the asconfig test in " + process . cwd ( ) ) ;
7074 process . exit ( 1 ) ;
7175 }
Original file line number Diff line number Diff line change 1+ {
2+ "targets" : {
3+ "debug" : {
4+ "debug" : true
5+ },
6+ "release" : {
7+ "optimize" : true
8+ }
9+ },
10+ "options" : {
11+ "noAssert" : true
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ if ( ! ASC_NO_ASSERT ) {
2+ assert ( false , "noAssert should be true" ) ;
3+ }
Original file line number Diff line number Diff line change 1+ {
2+ "extends" : " assemblyscript/std/assembly.json" ,
3+ "include" : [
4+ " ./**/*.ts"
5+ ]
6+ }
Original file line number Diff line number Diff line change 1+ {
2+ "debug" : false ,
3+ "optimize" : true ,
4+ "textFile" : " build/release/wat.wat"
5+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " wat" ,
3+ "license" : " MIT" ,
4+ "scripts" : {
5+ "test" : " ts-node .. --wat -- --showConfig"
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments