Skip to content

Commit

Permalink
Plumb setenv and test
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdy committed Jul 25, 2024
1 parent fe67039 commit 6e6c09f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/asherah.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class Asherah : public Napi::Addon<Asherah> {
try {
NapiUtils::RequireParameterCount(info, 1);
CobhanBufferNapi env_json(env, info[0]);
GoInt32 Result = ::SetEnv(env_json);
::SetEnv(env_json);
} catch (Napi::Error &e) {
e.ThrowAsJavaScriptException();
return;
Expand Down
1 change: 1 addition & 0 deletions src/asherah.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ export declare function set_max_stack_alloc_item_size(max_item_size: number): vo
export declare function set_safety_padding_overhead(safety_padding_overhead: number): void;
export declare function set_log_hook(logHook: LogHookCallback): void;
export declare function get_setup_status(): boolean;
export declare function setenv(environment: string): void;
8 changes: 7 additions & 1 deletion test/asherah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
shutdown_async,
get_setup_status,
set_max_stack_alloc_item_size,
set_log_hook
set_log_hook,
setenv
} from '../dist/asherah'

import { assert } from 'chai';
Expand Down Expand Up @@ -92,6 +93,11 @@ export async function asherah_setup_static_memory_async(verbose = false, session
}
}

export async function asherah_set_env(): Promise<void> {
const myString = '{"VAR": "VAL"}';
setenv(myString);
}

export function asherah_shutdown(): void {
shutdown();
}
Expand Down

0 comments on commit 6e6c09f

Please sign in to comment.