Expand display test to cover debug and OP_0
Add to the test to cover the `fmt::Debug` impl without checking the actual text. Change one of the opcodes so that the display of the special case OP_0 is checked.
This commit is contained in:
parent
8a096b77d5
commit
6bcc6b703d
|
@ -782,26 +782,28 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn script_display() {
|
fn script_display() {
|
||||||
let script = Script::from_bytes(&[0xa1, 0xb2, 0xc3]);
|
let script = Script::from_bytes(&[0x00, 0xa1, 0xb2]);
|
||||||
assert_eq!(format!("{}", script), "OP_LESSTHANOREQUAL OP_CSV OP_RETURN_195");
|
assert_eq!(format!("{}", script), "OP_0 OP_LESSTHANOREQUAL OP_CSV");
|
||||||
|
|
||||||
#[cfg(feature = "hex")]
|
#[cfg(feature = "hex")]
|
||||||
{
|
{
|
||||||
assert_eq!(format!("{:x}", script), "a1b2c3");
|
assert_eq!(format!("{:x}", script), "00a1b2");
|
||||||
assert_eq!(format!("{:X}", script), "A1B2C3");
|
assert_eq!(format!("{:X}", script), "00A1B2");
|
||||||
}
|
}
|
||||||
|
assert!(!format!("{:?}", script).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn scriptbuf_display() {
|
fn scriptbuf_display() {
|
||||||
let script_buf = ScriptBuf::from(vec![0xa1, 0xb2, 0xc3]);
|
let script_buf = ScriptBuf::from(vec![0x00, 0xa1, 0xb2]);
|
||||||
assert_eq!(format!("{}", script_buf), "OP_LESSTHANOREQUAL OP_CSV OP_RETURN_195");
|
assert_eq!(format!("{}", script_buf), "OP_0 OP_LESSTHANOREQUAL OP_CSV");
|
||||||
|
|
||||||
#[cfg(feature = "hex")]
|
#[cfg(feature = "hex")]
|
||||||
{
|
{
|
||||||
assert_eq!(format!("{:x}", script_buf), "a1b2c3");
|
assert_eq!(format!("{:x}", script_buf), "00a1b2");
|
||||||
assert_eq!(format!("{:X}", script_buf), "A1B2C3");
|
assert_eq!(format!("{:X}", script_buf), "00A1B2");
|
||||||
}
|
}
|
||||||
|
assert!(!format!("{:?}", script_buf).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue