mirror of
https://github.com/fluencelabs/marine.git
synced 2025-03-15 14:00:50 +00:00
comment logging, remove additional export from greeting
This commit is contained in:
parent
ce90ae08ab
commit
e7db519260
@ -26,15 +26,6 @@ pub fn greeting(name: String) -> String {
|
|||||||
format!("Hi, {}", name)
|
format!("Hi, {}", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[marine]
|
|
||||||
pub fn greeting_array(name: Vec<u8>) -> String {
|
|
||||||
let mut s = String::new();
|
|
||||||
for byte in name {
|
|
||||||
s.push(byte as char);
|
|
||||||
}
|
|
||||||
format!("Hi, {}", s)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use marine_rs_sdk_test::marine_test;
|
use marine_rs_sdk_test::marine_test;
|
||||||
|
@ -55,17 +55,17 @@ export function read_byte(module_name, offset) {
|
|||||||
module.exports.call_export = function (instance, export_name, args) {
|
module.exports.call_export = function (instance, export_name, args) {
|
||||||
//console.log("JS: call_export called with: ", instance, export_name, args)
|
//console.log("JS: call_export called with: ", instance, export_name, args)
|
||||||
let parsed_args = JSON.parse(args);
|
let parsed_args = JSON.parse(args);
|
||||||
console.log("parsed args: ", args);
|
//console.log("parsed args: ", args);
|
||||||
let prepared_args = [];
|
let prepared_args = [];
|
||||||
for (let i = 0; i < parsed_args.length; i++) {
|
for (let i = 0; i < parsed_args.length; i++) {
|
||||||
let arg = parsed_args[i];
|
let arg = parsed_args[i];
|
||||||
console.log(arg)
|
// console.log(arg)
|
||||||
prepared_args.push(arg["I32"])
|
prepared_args.push(arg["I32"])
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("prepared args: ", prepared_args);
|
//console.log("prepared args: ", prepared_args);
|
||||||
let result = instance.exports[export_name](...prepared_args);
|
let result = instance.exports[export_name](...prepared_args);
|
||||||
console.log("got result: ", result)
|
//console.log("got result: ", result)
|
||||||
let json_string = "[]";
|
let json_string = "[]";
|
||||||
if (result !== undefined) {
|
if (result !== undefined) {
|
||||||
json_string = "[" + JSON.stringify(result) + "]"
|
json_string = "[" + JSON.stringify(result) + "]"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user