-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from wasmerio/fix/emscripten-env
Fix support for env vars (put, set, unset)
- Loading branch information
Showing
10 changed files
with
123 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main() | ||
{ | ||
printf("INIT\n"); | ||
const char* UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR"); | ||
printf("UNEXISTENT_ENVVAR = %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]"); | ||
printf("Setting UNEXISTENT_ENVVAR=PUTENV (via putenv)\n"); | ||
putenv("UNEXISTENT_ENVVAR=PUTENV"); | ||
UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR"); | ||
printf("UNEXISTENT_ENVVAR = %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]"); | ||
printf("Setting UNEXISTENT_ENVVAR=SETENV (via setenv, overwrite)\n"); | ||
setenv("UNEXISTENT_ENVVAR", "SETENV", 1); | ||
UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR"); | ||
printf("UNEXISTENT_ENVVAR = %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]"); | ||
printf("Setting UNEXISTENT_ENVVAR=SETENV_NEW (via setenv, NO overwrite)\n"); | ||
setenv("UNEXISTENT_ENVVAR", "SETENV_NEW", 0); | ||
UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR"); | ||
printf("UNEXISTENT_ENVVAR = %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]"); | ||
printf("Unsetting UNEXISTENT_ENVVAR\n"); | ||
unsetenv("UNEXISTENT_ENVVAR"); | ||
UNEXISTENT_ENVVAR = getenv("UNEXISTENT_ENVVAR"); | ||
printf("UNEXISTENT_ENVVAR = %s\n",(UNEXISTENT_ENVVAR!=NULL)? UNEXISTENT_ENVVAR : "[NULL]"); | ||
printf("END\n"); | ||
} |
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,11 @@ | ||
INIT | ||
UNEXISTENT_ENVVAR = [NULL] | ||
Setting UNEXISTENT_ENVVAR=PUTENV (via putenv) | ||
UNEXISTENT_ENVVAR = PUTENV | ||
Setting UNEXISTENT_ENVVAR=SETENV (via setenv, overwrite) | ||
UNEXISTENT_ENVVAR = SETENV | ||
Setting UNEXISTENT_ENVVAR=SETENV_NEW (via setenv, NO overwrite) | ||
UNEXISTENT_ENVVAR = SETENV | ||
Unsetting UNEXISTENT_ENVVAR | ||
UNEXISTENT_ENVVAR = [NULL] | ||
END |
Binary file not shown.
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[test] | ||
fn test_env() { | ||
assert_emscripten_output!( | ||
"../../emtests/env.wasm", | ||
"env", | ||
vec![], | ||
"../../emtests/env.output" | ||
); | ||
} |
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