@@ -33,14 +33,14 @@ public void shouldInvokeFunctionWithConfig() {
33
33
var config = Map .of ("key1" , "value1" );
34
34
var manifest = new Manifest (List .of (CODE .pathWasmSource ()), null , config );
35
35
var output = Extism .invokeFunction (manifest , "count_vowels" , "Hello World" );
36
- assertThat (output ).isEqualTo ("{\" count\" : 3 }" );
36
+ assertThat (output ).isEqualTo ("{\" count\" :3, \" total \" :3, \" vowels \" : \" aeiouAEIOU \" }" );
37
37
}
38
38
39
39
@ Test
40
40
public void shouldInvokeFunctionFromFileWasmSource () {
41
41
var manifest = new Manifest (CODE .pathWasmSource ());
42
42
var output = Extism .invokeFunction (manifest , "count_vowels" , "Hello World" );
43
- assertThat (output ).isEqualTo ("{\" count\" : 3 }" );
43
+ assertThat (output ).isEqualTo ("{\" count\" :3, \" total \" :3, \" vowels \" : \" aeiouAEIOU \" }" );
44
44
}
45
45
46
46
@ Test
@@ -109,7 +109,7 @@ public void shouldInvokeFunctionFromUrlWasmSource() {
109
109
public void shouldInvokeFunctionFromByteArrayWasmSource () {
110
110
var manifest = new Manifest (CODE .byteArrayWasmSource ());
111
111
var output = Extism .invokeFunction (manifest , "count_vowels" , "Hello World" );
112
- assertThat (output ).isEqualTo ("{\" count\" : 3 }" );
112
+ assertThat (output ).isEqualTo ("{\" count\" :3, \" total \" :3, \" vowels \" : \" aeiouAEIOU \" }" );
113
113
}
114
114
115
115
@ Test
@@ -131,7 +131,7 @@ public void shouldAllowInvokeFunctionFromFileWasmSourceApiUsageExample() {
131
131
132
132
try (var plugin = new Plugin (manifest , false , null )) {
133
133
var output = plugin .call (functionName , input );
134
- assertThat (output ).isEqualTo ( "{ \" count\" : 3} " );
134
+ assertThat (output ).contains ( " \" count\" :3 " );
135
135
}
136
136
}
137
137
@@ -143,10 +143,10 @@ public void shouldAllowInvokeFunctionFromFileWasmSourceMultipleTimes() {
143
143
144
144
try (var plugin = new Plugin (manifest , false , null )) {
145
145
var output = plugin .call (functionName , input );
146
- assertThat (output ).isEqualTo ( "{ \" count\" : 3} " );
146
+ assertThat (output ).contains ( " \" count\" :3 " );
147
147
148
148
output = plugin .call (functionName , input );
149
- assertThat (output ).isEqualTo ( "{ \" count\" : 3} " );
149
+ assertThat (output ).contains ( " \" count\" :3 " );
150
150
}
151
151
}
152
152
@@ -222,7 +222,7 @@ public void shouldAllowInvokeHostFunctionWithoutUserData() {
222
222
helloWorldFunction ,
223
223
Optional .empty ()
224
224
)
225
- .withNamespace ("env " );
225
+ .withNamespace ("extism:host/user " );
226
226
227
227
HostFunction g = new HostFunction <>(
228
228
"hello_world" ,
@@ -254,7 +254,7 @@ public void shouldFailToInvokeUnknownHostFunction() {
254
254
var plugin = new Plugin (manifest , true , null );
255
255
plugin .call (functionName , "this is a test" );
256
256
} catch (ExtismException e ) {
257
- assertThat (e .getMessage ()).contains ("unknown import: `env ::hello_world` has not been defined" );
257
+ assertThat (e .getMessage ()).contains ("unknown import: `extism:host/user ::hello_world` has not been defined" );
258
258
}
259
259
}
260
260
0 commit comments