mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Added emscripten env test
This commit is contained in:
parent
2c2d21044f
commit
332840afe3
@ -12,7 +12,8 @@ use std::process::Command;
|
||||
static BANNER: &str = "// Rust test file autogenerated with cargo build (build/emtests.rs).
|
||||
// Please do NOT modify it by hand, as it will be reseted on next build.\n";
|
||||
|
||||
const TESTS: [&str; 2] = [
|
||||
const TESTS: [&str; 3] = [
|
||||
"emtests/env.c",
|
||||
"emtests/puts.c",
|
||||
"emtests/printf.c"
|
||||
];
|
||||
|
13
emtests/env.c
Normal file
13
emtests/env.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int main()
|
||||
{
|
||||
printf("INIT\n");
|
||||
const char* UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR");
|
||||
printf("get UNEXISTENT_ENVVAR: %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]");
|
||||
printf("set UNEXISTENT_ENVVAR = SET\n");
|
||||
putenv("UNEXISTENT_ENVVAR=SET");
|
||||
UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR");
|
||||
printf("get UNEXISTENT_ENVVAR: %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]");
|
||||
printf("END\n");
|
||||
}
|
5
emtests/env.output
Normal file
5
emtests/env.output
Normal file
@ -0,0 +1,5 @@
|
||||
INIT
|
||||
get UNEXISTENT_ENVVAR: [NULL]
|
||||
set UNEXISTENT_ENVVAR = SET
|
||||
get UNEXISTENT_ENVVAR: SET
|
||||
END
|
BIN
emtests/env.wasm
Normal file
BIN
emtests/env.wasm
Normal file
Binary file not shown.
4
src/emtests/env.rs
Normal file
4
src/emtests/env.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#[test]
|
||||
fn test_env() {
|
||||
assert_emscripten_output!("../../emtests/env.wasm", "env", vec![], "../../emtests/env.output");
|
||||
}
|
@ -4,5 +4,6 @@
|
||||
// The _common module is not autogenerated, as it provides common macros for the emtests
|
||||
#[macro_use]
|
||||
mod _common;
|
||||
mod env;
|
||||
mod puts;
|
||||
mod printf;
|
||||
|
Loading…
Reference in New Issue
Block a user