Skip to content

Commit

Permalink
fix: fail to generate help for recursive custom types
Browse files Browse the repository at this point in the history
Initial minimal failing example
  • Loading branch information
willemneal committed Sep 10, 2024
1 parent 17f0fa5 commit 85165ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ pub enum ComplexEnum {
Void,
}

#[contracttype]
pub enum RecursiveEnum {
Vec(Vec<RecursiveEnum>),
Void,
}

#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[repr(u32)]
Expand Down Expand Up @@ -103,6 +109,10 @@ impl Contract {
complex
}

pub fn recursive_enum(_env: Env, recursive: RecursiveEnum) -> RecursiveEnum {
recursive
}

pub fn addresse(_env: Env, addresse: Address) -> Address {
addresse
}
Expand Down
7 changes: 7 additions & 0 deletions cmd/crates/soroban-test/tests/it/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ async fn complex_enum_help() {
assert!(output.contains(r#""Void"'"#));
}

#[tokio::test]
async fn recursive_enum_help() {
let output = invoke_custom("recursive_enum", "--help").await.unwrap();
assert!(output.contains(r#"--complex"#,));
assert!(output.contains(r#""Void"'"#));
}

#[tokio::test]
async fn multi_arg_failure() {
assert!(matches!(
Expand Down

0 comments on commit 85165ed

Please sign in to comment.