Skip to content

Commit

Permalink
fix: xdr update
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Dec 7, 2023
1 parent f58b32e commit c7d9774
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
22 changes: 13 additions & 9 deletions cmd/crates/soroban-spec-tools/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ impl Display for Contract {
}

fn write_func(f: &mut std::fmt::Formatter<'_>, func: &ScSpecFunctionV0) -> std::fmt::Result {
writeln!(f, " • Function: {}", func.name.to_string_lossy())?;
writeln!(f, " • Function: {}", func.name.to_utf8_string_lossy())?;
if func.doc.len() > 0 {
writeln!(
f,
" Docs: {}",
&indent(&func.doc.to_string_lossy(), 11).trim()
&indent(&func.doc.to_utf8_string_lossy(), 11).trim()
)?;
}
writeln!(
Expand All @@ -185,7 +185,7 @@ fn write_union(f: &mut std::fmt::Formatter<'_>, udt: &ScSpecUdtUnionV0) -> std::
writeln!(
f,
" Docs: {}",
indent(&udt.doc.to_string_lossy(), 10).trim()
indent(&udt.doc.to_utf8_string_lossy(), 10).trim()
)?;
}
writeln!(f, " Cases:")?;
Expand All @@ -202,15 +202,15 @@ fn write_struct(f: &mut std::fmt::Formatter<'_>, udt: &ScSpecUdtStructV0) -> std
writeln!(
f,
" Docs: {}",
indent(&udt.doc.to_string_lossy(), 10).trim()
indent(&udt.doc.to_utf8_string_lossy(), 10).trim()
)?;
}
writeln!(f, " Fields:")?;
for field in udt.fields.iter() {
writeln!(
f,
" • {}: {}",
field.name.to_string_lossy(),
field.name.to_utf8_string_lossy(),
indent(&format!("{:#?}", field.type_), 8).trim()
)?;
if field.doc.len() > 0 {
Expand All @@ -227,7 +227,7 @@ fn write_enum(f: &mut std::fmt::Formatter<'_>, udt: &ScSpecUdtEnumV0) -> std::fm
writeln!(
f,
" Docs: {}",
indent(&udt.doc.to_string_lossy(), 10).trim()
indent(&udt.doc.to_utf8_string_lossy(), 10).trim()
)?;
}
writeln!(f, " Cases:")?;
Expand All @@ -244,7 +244,7 @@ fn write_error(f: &mut std::fmt::Formatter<'_>, udt: &ScSpecUdtErrorEnumV0) -> s
writeln!(
f,
" Docs: {}",
indent(&udt.doc.to_string_lossy(), 10).trim()
indent(&udt.doc.to_utf8_string_lossy(), 10).trim()
)?;
}
writeln!(f, " Cases:")?;
Expand All @@ -265,8 +265,12 @@ fn indent(s: &str, n: usize) -> String {

fn format_name(lib: &StringM<80>, name: &StringM<60>) -> String {
if lib.len() > 0 {
format!("{}::{}", lib.to_string_lossy(), name.to_string_lossy())
format!(
"{}::{}",
lib.to_utf8_string_lossy(),
name.to_utf8_string_lossy()
)
} else {
name.to_string_lossy()
name.to_utf8_string_lossy()
}
}
4 changes: 1 addition & 3 deletions cmd/crates/soroban-test/tests/it/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,15 @@ fn generate_identity() {
#[test]
fn seed_phrase() {
let sandbox = TestEnv::default();
let dir = sandbox.dir();
add_identity(
dir,
sandbox.dir(),
"test_seed",
SecretKind::Seed,
"one two three four five six seven eight nine ten eleven twelve",
);

sandbox
.new_assert_cmd("config")
.current_dir(dir)
.arg("identity")
.arg("ls")
.assert()
Expand Down

0 comments on commit c7d9774

Please sign in to comment.