Fix formatter discarding nul bytes.
This commit is contained in:
parent
b761d6a76d
commit
d581183cc6
|
@ -16,6 +16,7 @@
|
|||
- **aikup**: error message when version is not found. @rvcas
|
||||
- **aiken**: support outputting mainnet addresses for validators. @rvcas
|
||||
- **aiken-lang**: added serde to CheckedModule to encode modules as cbor. @rvcas
|
||||
- **aiken-lang**: Strings can contain a nul byte using the escape sequence `\0`. @KtorZ
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -32,7 +33,7 @@
|
|||
- **aiken-lang**: disallow `MLResult` in a type definition. @rvcas
|
||||
- **aiken-lang**: reversed deserialization of bls types out of data types. @rvcas
|
||||
- **aiken-lang**: validator args unexpectedly unbound causing code gen crashes. @rvcas
|
||||
- **aiken-lang**: allow implicitly discarded values when right-hand-side unified with `Void`. @KtorZ
|
||||
- **aiken-lang**: allow implicitly discarded values when right-hand side unified with `Void`. @KtorZ
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -2138,6 +2138,7 @@ fn escape(string: &str) -> String {
|
|||
'\n' => vec!['\\', 'n'],
|
||||
'\r' => vec!['\\', 'r'],
|
||||
'\t' => vec!['\\', 't'],
|
||||
'\0' => vec!['\\', '0'],
|
||||
'"' => vec!['\\', c],
|
||||
'\\' => vec!['\\', c],
|
||||
_ => vec![c],
|
||||
|
|
|
@ -20,6 +20,18 @@ fn format_simple_module() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_nul_byte() {
|
||||
assert_format!(
|
||||
r#"
|
||||
fn label(str: String) -> Void {
|
||||
str
|
||||
|> builtin.append_string(@"\0", _)
|
||||
|> builtin.debug(Void)
|
||||
}"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_g1_element_constant() {
|
||||
assert_format!(
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
source: crates/aiken-lang/src/tests/format.rs
|
||||
description: "Code:\n\nfn label(str: String) -> Void {\n str\n |> builtin.append_string(@\"\\0\", _)\n |> builtin.debug(Void)\n}"
|
||||
---
|
||||
fn label(str: String) -> Void {
|
||||
str
|
||||
|> builtin.append_string(@"\0", _)
|
||||
|> builtin.debug(Void)
|
||||
}
|
Loading…
Reference in New Issue