Skip to content

Commit

Permalink
Merge branch 'main' into feat/use-rich-printer-for-init
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman authored Aug 30, 2024
2 parents e0b5b86 + d11c7e0 commit 780d444
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#![no_std]
use soroban_sdk::{contract, contractimpl, symbol_short, vec, Env, Symbol, Vec};
use soroban_sdk::{contract, contractimpl, vec, Env, String, Vec};

#[contract]
pub struct HelloContract;

#[contractimpl]
impl HelloContract {
pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
vec![&env, symbol_short!("Hello"), to]
pub fn hello(env: Env, to: String) -> Vec<String> {
vec![&env, String::from_str(&env, "Hello"), to]
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#![cfg(test)]

use super::*;
use soroban_sdk::{symbol_short, vec, Env};
use soroban_sdk::{vec, Env, String};

#[test]
fn test() {
let env = Env::default();
let contract_id = env.register_contract(None, HelloContract);
let client = HelloContractClient::new(&env, &contract_id);

let words = client.hello(&symbol_short!("Dev"));
let words = client.hello(&String::from_str(&env, "Dev"));
assert_eq!(
words,
vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]
vec![
&env,
String::from_str(&env, "Hello"),
String::from_str(&env, "Dev"),
]
);
}

0 comments on commit 780d444

Please sign in to comment.