File tree Expand file tree Collapse file tree
js_function_javy_plugin_v4 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,5 +4,7 @@ fn main() {
44 println ! ( "cargo:rerun-if-changed=providers/javy_quickjs_provider_v3.wasm" ) ;
55 println ! ( "cargo:rerun-if-changed=providers/shopify_functions_javy_v1.wasm" ) ;
66 println ! ( "cargo:rerun-if-changed=providers/shopify_functions_javy_v2.wasm" ) ;
7+ println ! ( "cargo:rerun-if-changed=providers/shopify_functions_javy_v3.wasm" ) ;
8+ println ! ( "cargo:rerun-if-changed=providers/shopify_functions_javy_v4.wasm" ) ;
79 println ! ( "cargo:rerun-if-changed=providers/shopify_function_v1.wasm" ) ;
810}
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ js_function_javy_plugin_v3.wasm:
4343javy build -C dynamic -C plugin=providers/shopify_functions_javy_v3.wasm -o tests/fixtures/build/js_function_javy_plugin_v3.wasm tests/fixtures/js_function_javy_plugin_v3/function.js
4444```
4545
46+ js_function_javy_plugin_v4.wasm:
47+ ```
48+ javy build -C dynamic -C plugin=providers/shopify_functions_javy_v4.wasm -o tests/fixtures/build/js_function_javy_plugin_v4.wasm tests/fixtures/js_function_javy_plugin_v4/function.js
49+ ```
50+
4651** ` *.wat ` examples:**
4752```
4853find tests/fixtures -maxdepth 1 -type f -name "*.wat" \
Original file line number Diff line number Diff line change 1+ const inputObj = ShopifyFunction . readInput ( ) ;
2+ console . error ( "this is an error message" ) ;
3+ const outputObj = { hello : inputObj . hello + " output" } ;
4+ ShopifyFunction . writeOutput ( outputObj ) ;
Original file line number Diff line number Diff line change @@ -438,21 +438,28 @@ mod tests {
438438
439439 #[ test]
440440 fn run_javy_plugin_v3 ( ) -> Result < ( ) > {
441+ run_javy_plugin_fixture ( "tests/fixtures/build/js_function_javy_plugin_v3.wasm" )
442+ }
443+
444+ #[ test]
445+ fn run_javy_plugin_v4 ( ) -> Result < ( ) > {
446+ run_javy_plugin_fixture ( "tests/fixtures/build/js_function_javy_plugin_v4.wasm" )
447+ }
448+
449+ fn run_javy_plugin_fixture ( function_path : & str ) -> Result < ( ) > {
441450 let mut cmd = Command :: new ( cargo_bin ! ( ) ) ;
442451 let input = temp_input ( json ! ( { "hello" : "world" } ) ) ?;
443452
444- cmd. args ( [
445- "--function" ,
446- "tests/fixtures/build/js_function_javy_plugin_v3.wasm" ,
447- ] )
448- . arg ( "--json" )
449- . arg ( "--input" )
450- . arg ( input. as_os_str ( ) )
451- . stdout ( Stdio :: piped ( ) )
452- . spawn ( )
453- . expect ( "Failed to spawn child process" )
454- . wait_with_output ( )
455- . expect ( "Failed waiting for output" ) ;
453+ cmd. arg ( "--function" )
454+ . arg ( function_path)
455+ . arg ( "--json" )
456+ . arg ( "--input" )
457+ . arg ( input. as_os_str ( ) )
458+ . stdout ( Stdio :: piped ( ) )
459+ . spawn ( )
460+ . expect ( "Failed to spawn child process" )
461+ . wait_with_output ( )
462+ . expect ( "Failed waiting for output" ) ;
456463
457464 // Command should succeed
458465 cmd. assert ( ) . success ( ) ;
You can’t perform that action at this time.
0 commit comments