mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
update to marine, marine-test, bump versions
This commit is contained in:
parent
ccddb4613e
commit
e17fab988e
@ -12,4 +12,7 @@ name = "greeting"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence = "0.6.2"
|
||||
fluence = "0.6.9"
|
||||
|
||||
[dev-dependencies]
|
||||
fluence-test = "0.1.9"
|
@ -3,7 +3,8 @@ set -o errexit -o nounset -o pipefail
|
||||
|
||||
# This script builds all subprojects and puts all created Wasm modules in one dir
|
||||
cargo update
|
||||
fce build --release
|
||||
marine build --release
|
||||
|
||||
rm artifacts/*
|
||||
mkdir -p artifacts
|
||||
rm -f artifacts/*.wasm
|
||||
cp target/wasm32-wasi/release/greeting.wasm artifacts/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020 Fluence Labs Limited
|
||||
* Copyright 2021 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,14 +14,31 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use fluence::fce;
|
||||
use fluence::marine;
|
||||
use fluence::module_manifest;
|
||||
|
||||
module_manifest!();
|
||||
|
||||
pub fn main() {}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn greeting(name: String) -> String {
|
||||
format!("Hi, {}", name)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use fluence_test::marine_test;
|
||||
|
||||
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")]
|
||||
fn empty_string() {
|
||||
let actual = greeting.greeting(String::new());
|
||||
assert_eq!(actual, "Hi, ");
|
||||
}
|
||||
|
||||
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")]
|
||||
fn non_empty_string() {
|
||||
let actual = greeting.greeting("name".to_string());
|
||||
assert_eq!(actual, "Hi, name");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user