-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v.pref: allow for
-os wasm32_emscripten
and later filtering `_d_was…
…m32_emscripten.c.v` and `_notd_wasm32_emscripten.c.v` files.
- Loading branch information
Showing
7 changed files
with
87 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
vlib/v/tests/project_compiling_to_wasm/abc_d_wasm32_emscripten.c.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module main | ||
|
||
fn abc() { | ||
println('This is abc_d_wasm32_emscripten.c.v') | ||
} |
5 changes: 5 additions & 0 deletions
5
vlib/v/tests/project_compiling_to_wasm/abc_notd_wasm32_emscripten.c.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module main | ||
|
||
fn abc() { | ||
println('This is abc_notd_wasm32_emscripten.c.v') | ||
} |
45 changes: 45 additions & 0 deletions
45
.../v/tests/project_compiling_to_wasm/compilation_to_wasm_works_with_d_and_notd_files_test.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
|
||
const vexe = os.quoted_path(@VEXE) | ||
const project_folder = os.dir(@FILE) | ||
const output_path = os.join_path(os.vtmp_dir(), 'check_wasm_works') | ||
|
||
fn testsuite_begin() { | ||
os.mkdir_all(output_path) or {} | ||
os.chdir(output_path)! | ||
dump(os.getwd()) | ||
} | ||
|
||
fn testsuite_end() { | ||
os.system('ls -la .') | ||
os.chdir(os.home_dir()) or {} | ||
os.rmdir_all(output_path) or {} | ||
} | ||
|
||
fn test_normal() { | ||
defer { println('done ${@FN}') } | ||
dump(vexe) | ||
res := os.system('${os.quoted_path(vexe)} -o normal.exe ${os.quoted_path(project_folder)}') | ||
assert res == 0 | ||
dump(res) | ||
assert os.exists('normal.exe') | ||
content := os.read_file('normal.exe')! | ||
assert content.contains('This is abc_notd_wasm32_emscripten.c.v') | ||
} | ||
|
||
fn test_emcc() { | ||
defer { println('done ${@FN}') } | ||
emcc := os.find_abs_path_of_executable('emcc') or { | ||
println('skipping ${@FN} since `emcc` is not found') | ||
return | ||
} | ||
dump(emcc) | ||
res := os.system('${os.quoted_path(vexe)} -os wasm32_emscripten -o wasm_check.html ${os.quoted_path(project_folder)}') | ||
assert res == 0 | ||
dump(res) | ||
assert os.exists('wasm_check.html') | ||
assert os.exists('wasm_check.js') | ||
assert os.exists('wasm_check.wasm') | ||
content := os.read_file('wasm_check.wasm')! | ||
assert content.contains('This is abc_d_wasm32_emscripten.c.v') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module main | ||
|
||
fn main() { | ||
abc() | ||
println('hi from main.v') | ||
} |
Empty file.