@@ -138,7 +138,7 @@ class ActionLoopRustBasicTests extends BasicActionRunnerTests with WskActorSyste
138
138
|}
139
139
""" .stripMargin)
140
140
141
- it should " support array result" in {
141
+ it should " support return array result" in {
142
142
val (out, err) = withActionLoopContainer { c =>
143
143
val code = """
144
144
|extern crate serde_json;
@@ -162,4 +162,33 @@ class ActionLoopRustBasicTests extends BasicActionRunnerTests with WskActorSyste
162
162
runRes shouldBe Some (JsArray (JsString (" a" ), JsString (" b" )))
163
163
}
164
164
}
165
+
166
+ it should " support array as input param" in {
167
+ val (out, err) = withActionLoopContainer { c =>
168
+ val code = """
169
+ |extern crate serde_json;
170
+ |
171
+ |use serde_derive::{Deserialize, Serialize};
172
+ |use serde_json::{Error, Value};
173
+ |
174
+ |
175
+ |pub fn main(args: Value) -> Result<Value, Error> {
176
+ | let inputParam = args.as_array();
177
+ | let defaultOutput = ["c", "d"];
178
+ | match inputParam {
179
+ | None => serde_json::to_value(defaultOutput),
180
+ | Some(x) => serde_json::to_value(x),
181
+ | }
182
+ |}
183
+ """ .stripMargin
184
+
185
+ val (initCode, _) = c.init(initPayload(code))
186
+
187
+ initCode should be(200 )
188
+
189
+ val (runCode, runRes) = c.runForJsArray(runPayload(JsArray (JsString (" a" ), JsString (" b" ))))
190
+ runCode should be(200 )
191
+ runRes shouldBe Some (JsArray (JsString (" a" ), JsString (" b" )))
192
+ }
193
+ }
165
194
}
0 commit comments