Use x.to_string() instead of format!("{}", x).
Both use the Display trait.
This commit is contained in:
@@ -493,7 +493,7 @@ mod tests {
|
|||||||
assert_eq!(x, y);
|
assert_eq!(x, y);
|
||||||
|
|
||||||
assert_eq!(format!("{:?}", Opcode::IaddImm), "IaddImm");
|
assert_eq!(format!("{:?}", Opcode::IaddImm), "IaddImm");
|
||||||
assert_eq!(format!("{}", Opcode::IaddImm), "iadd_imm");
|
assert_eq!(Opcode::IaddImm.to_string(), "iadd_imm");
|
||||||
|
|
||||||
// Check the matcher.
|
// Check the matcher.
|
||||||
assert_eq!("iadd".parse::<Opcode>(), Ok(Opcode::Iadd));
|
assert_eq!("iadd".parse::<Opcode>(), Ok(Opcode::Iadd));
|
||||||
@@ -505,13 +505,13 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_imm64() {
|
fn format_imm64() {
|
||||||
assert_eq!(format!("{}", Imm64(0)), "0");
|
assert_eq!(Imm64(0).to_string(), "0");
|
||||||
assert_eq!(format!("{}", Imm64(9999)), "9999");
|
assert_eq!(Imm64(9999).to_string(), "9999");
|
||||||
assert_eq!(format!("{}", Imm64(10000)), "0x2710");
|
assert_eq!(Imm64(10000).to_string(), "0x2710");
|
||||||
assert_eq!(format!("{}", Imm64(-9999)), "-9999");
|
assert_eq!(Imm64(-9999).to_string(), "-9999");
|
||||||
assert_eq!(format!("{}", Imm64(-10000)), "0xffff_ffff_ffff_d8f0");
|
assert_eq!(Imm64(-10000).to_string(), "0xffff_ffff_ffff_d8f0");
|
||||||
assert_eq!(format!("{}", Imm64(0xffff)), "0xffff");
|
assert_eq!(Imm64(0xffff).to_string(), "0xffff");
|
||||||
assert_eq!(format!("{}", Imm64(0x10000)), "0x0001_0000");
|
assert_eq!(Imm64(0x10000).to_string(), "0x0001_0000");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that `text` can be parsed as a `T` into a value that displays as `want`.
|
// Verify that `text` can be parsed as a `T` into a value that displays as `want`.
|
||||||
@@ -520,7 +520,7 @@ mod tests {
|
|||||||
{
|
{
|
||||||
match text.parse::<T>() {
|
match text.parse::<T>() {
|
||||||
Err(s) => panic!("\"{}\".parse() error: {}", text, s),
|
Err(s) => panic!("\"{}\".parse() error: {}", text, s),
|
||||||
Ok(x) => assert_eq!(format!("{}", x), want),
|
Ok(x) => assert_eq!(x.to_string(), want),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,7 +529,7 @@ mod tests {
|
|||||||
where <T as FromStr>::Err: Display
|
where <T as FromStr>::Err: Display
|
||||||
{
|
{
|
||||||
match text.parse::<T>() {
|
match text.parse::<T>() {
|
||||||
Err(s) => assert_eq!(format!("{}", s), msg),
|
Err(s) => assert_eq!(s.to_string(), msg),
|
||||||
Ok(x) => panic!("Wanted Err({}), but got {}", msg, x),
|
Ok(x) => panic!("Wanted Err({}), but got {}", msg, x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -584,33 +584,32 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_ieee32() {
|
fn format_ieee32() {
|
||||||
assert_eq!(format!("{}", Ieee32::new(0.0)), "0.0");
|
assert_eq!(Ieee32::new(0.0).to_string(), "0.0");
|
||||||
assert_eq!(format!("{}", Ieee32::new(-0.0)), "-0.0");
|
assert_eq!(Ieee32::new(-0.0).to_string(), "-0.0");
|
||||||
assert_eq!(format!("{}", Ieee32::new(1.0)), "0x1.000000p0");
|
assert_eq!(Ieee32::new(1.0).to_string(), "0x1.000000p0");
|
||||||
assert_eq!(format!("{}", Ieee32::new(1.5)), "0x1.800000p0");
|
assert_eq!(Ieee32::new(1.5).to_string(), "0x1.800000p0");
|
||||||
assert_eq!(format!("{}", Ieee32::new(0.5)), "0x1.000000p-1");
|
assert_eq!(Ieee32::new(0.5).to_string(), "0x1.000000p-1");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::EPSILON)), "0x1.000000p-23");
|
assert_eq!(Ieee32::new(f32::EPSILON).to_string(), "0x1.000000p-23");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::MIN)), "-0x1.fffffep127");
|
assert_eq!(Ieee32::new(f32::MIN).to_string(), "-0x1.fffffep127");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::MAX)), "0x1.fffffep127");
|
assert_eq!(Ieee32::new(f32::MAX).to_string(), "0x1.fffffep127");
|
||||||
// Smallest positive normal number.
|
// Smallest positive normal number.
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::MIN_POSITIVE)),
|
assert_eq!(Ieee32::new(f32::MIN_POSITIVE).to_string(),
|
||||||
"0x1.000000p-126");
|
"0x1.000000p-126");
|
||||||
// Subnormals.
|
// Subnormals.
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::MIN_POSITIVE / 2.0)),
|
assert_eq!(Ieee32::new(f32::MIN_POSITIVE / 2.0).to_string(),
|
||||||
"0x0.800000p-126");
|
"0x0.800000p-126");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::MIN_POSITIVE * f32::EPSILON)),
|
assert_eq!(Ieee32::new(f32::MIN_POSITIVE * f32::EPSILON).to_string(),
|
||||||
"0x0.000002p-126");
|
"0x0.000002p-126");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::INFINITY)), "Inf");
|
assert_eq!(Ieee32::new(f32::INFINITY).to_string(), "Inf");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::NEG_INFINITY)), "-Inf");
|
assert_eq!(Ieee32::new(f32::NEG_INFINITY).to_string(), "-Inf");
|
||||||
assert_eq!(format!("{}", Ieee32::new(f32::NAN)), "NaN");
|
assert_eq!(Ieee32::new(f32::NAN).to_string(), "NaN");
|
||||||
assert_eq!(format!("{}", Ieee32::new(-f32::NAN)), "-NaN");
|
assert_eq!(Ieee32::new(-f32::NAN).to_string(), "-NaN");
|
||||||
// Construct some qNaNs with payloads.
|
// Construct some qNaNs with payloads.
|
||||||
assert_eq!(format!("{}", Ieee32::from_bits(0x7fc00001)), "NaN:0x1");
|
assert_eq!(Ieee32::from_bits(0x7fc00001).to_string(), "NaN:0x1");
|
||||||
assert_eq!(format!("{}", Ieee32::from_bits(0x7ff00001)), "NaN:0x300001");
|
assert_eq!(Ieee32::from_bits(0x7ff00001).to_string(), "NaN:0x300001");
|
||||||
// Signaling NaNs.
|
// Signaling NaNs.
|
||||||
assert_eq!(format!("{}", Ieee32::from_bits(0x7f800001)), "sNaN:0x1");
|
assert_eq!(Ieee32::from_bits(0x7f800001).to_string(), "sNaN:0x1");
|
||||||
assert_eq!(format!("{}", Ieee32::from_bits(0x7fa00001)),
|
assert_eq!(Ieee32::from_bits(0x7fa00001).to_string(), "sNaN:0x200001");
|
||||||
"sNaN:0x200001");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -682,38 +681,35 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_ieee64() {
|
fn format_ieee64() {
|
||||||
assert_eq!(format!("{}", Ieee64::new(0.0)), "0.0");
|
assert_eq!(Ieee64::new(0.0).to_string(), "0.0");
|
||||||
assert_eq!(format!("{}", Ieee64::new(-0.0)), "-0.0");
|
assert_eq!(Ieee64::new(-0.0).to_string(), "-0.0");
|
||||||
assert_eq!(format!("{}", Ieee64::new(1.0)), "0x1.0000000000000p0");
|
assert_eq!(Ieee64::new(1.0).to_string(), "0x1.0000000000000p0");
|
||||||
assert_eq!(format!("{}", Ieee64::new(1.5)), "0x1.8000000000000p0");
|
assert_eq!(Ieee64::new(1.5).to_string(), "0x1.8000000000000p0");
|
||||||
assert_eq!(format!("{}", Ieee64::new(0.5)), "0x1.0000000000000p-1");
|
assert_eq!(Ieee64::new(0.5).to_string(), "0x1.0000000000000p-1");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::EPSILON)),
|
assert_eq!(Ieee64::new(f64::EPSILON).to_string(),
|
||||||
"0x1.0000000000000p-52");
|
"0x1.0000000000000p-52");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::MIN)),
|
assert_eq!(Ieee64::new(f64::MIN).to_string(), "-0x1.fffffffffffffp1023");
|
||||||
"-0x1.fffffffffffffp1023");
|
assert_eq!(Ieee64::new(f64::MAX).to_string(), "0x1.fffffffffffffp1023");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::MAX)),
|
|
||||||
"0x1.fffffffffffffp1023");
|
|
||||||
// Smallest positive normal number.
|
// Smallest positive normal number.
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::MIN_POSITIVE)),
|
assert_eq!(Ieee64::new(f64::MIN_POSITIVE).to_string(),
|
||||||
"0x1.0000000000000p-1022");
|
"0x1.0000000000000p-1022");
|
||||||
// Subnormals.
|
// Subnormals.
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::MIN_POSITIVE / 2.0)),
|
assert_eq!(Ieee64::new(f64::MIN_POSITIVE / 2.0).to_string(),
|
||||||
"0x0.8000000000000p-1022");
|
"0x0.8000000000000p-1022");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::MIN_POSITIVE * f64::EPSILON)),
|
assert_eq!(Ieee64::new(f64::MIN_POSITIVE * f64::EPSILON).to_string(),
|
||||||
"0x0.0000000000001p-1022");
|
"0x0.0000000000001p-1022");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::INFINITY)), "Inf");
|
assert_eq!(Ieee64::new(f64::INFINITY).to_string(), "Inf");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::NEG_INFINITY)), "-Inf");
|
assert_eq!(Ieee64::new(f64::NEG_INFINITY).to_string(), "-Inf");
|
||||||
assert_eq!(format!("{}", Ieee64::new(f64::NAN)), "NaN");
|
assert_eq!(Ieee64::new(f64::NAN).to_string(), "NaN");
|
||||||
assert_eq!(format!("{}", Ieee64::new(-f64::NAN)), "-NaN");
|
assert_eq!(Ieee64::new(-f64::NAN).to_string(), "-NaN");
|
||||||
// Construct some qNaNs with payloads.
|
// Construct some qNaNs with payloads.
|
||||||
assert_eq!(format!("{}", Ieee64::from_bits(0x7ff8000000000001)),
|
assert_eq!(Ieee64::from_bits(0x7ff8000000000001).to_string(), "NaN:0x1");
|
||||||
"NaN:0x1");
|
assert_eq!(Ieee64::from_bits(0x7ffc000000000001).to_string(),
|
||||||
assert_eq!(format!("{}", Ieee64::from_bits(0x7ffc000000000001)),
|
|
||||||
"NaN:0x4000000000001");
|
"NaN:0x4000000000001");
|
||||||
// Signaling NaNs.
|
// Signaling NaNs.
|
||||||
assert_eq!(format!("{}", Ieee64::from_bits(0x7ff0000000000001)),
|
assert_eq!(Ieee64::from_bits(0x7ff0000000000001).to_string(),
|
||||||
"sNaN:0x1");
|
"sNaN:0x1");
|
||||||
assert_eq!(format!("{}", Ieee64::from_bits(0x7ff4000000000001)),
|
assert_eq!(Ieee64::from_bits(0x7ff4000000000001).to_string(),
|
||||||
"sNaN:0x4000000000001");
|
"sNaN:0x4000000000001");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ mod tests {
|
|||||||
ty: types::I32,
|
ty: types::I32,
|
||||||
};
|
};
|
||||||
let inst = func.make_inst(idata);
|
let inst = func.make_inst(idata);
|
||||||
assert_eq!(format!("{}", inst), "inst0");
|
assert_eq!(inst.to_string(), "inst0");
|
||||||
|
|
||||||
// Immutable reference resolution.
|
// Immutable reference resolution.
|
||||||
let ins = func.inst(inst);
|
let ins = func.inst(inst);
|
||||||
@@ -463,8 +463,8 @@ mod tests {
|
|||||||
|
|
||||||
let ss0 = func.make_stack_slot(StackSlotData::new(4));
|
let ss0 = func.make_stack_slot(StackSlotData::new(4));
|
||||||
let ss1 = func.make_stack_slot(StackSlotData::new(8));
|
let ss1 = func.make_stack_slot(StackSlotData::new(8));
|
||||||
assert_eq!(format!("{}", ss0), "ss0");
|
assert_eq!(ss0.to_string(), "ss0");
|
||||||
assert_eq!(format!("{}", ss1), "ss1");
|
assert_eq!(ss1.to_string(), "ss1");
|
||||||
|
|
||||||
assert_eq!(func[ss0].size, 4);
|
assert_eq!(func[ss0].size, 4);
|
||||||
assert_eq!(func[ss1].size, 8);
|
assert_eq!(func[ss1].size, 8);
|
||||||
|
|||||||
@@ -337,38 +337,37 @@ mod tests {
|
|||||||
assert_eq!(big.lane_count(), 256);
|
assert_eq!(big.lane_count(), 256);
|
||||||
assert_eq!(big.bits(), 64 * 256);
|
assert_eq!(big.bits(), 64 * 256);
|
||||||
|
|
||||||
assert_eq!(format!("{}", big.half_vector().unwrap()), "f64x128");
|
assert_eq!(big.half_vector().unwrap().to_string(), "f64x128");
|
||||||
assert_eq!(format!("{}", B1.by(2).unwrap().half_vector().unwrap()),
|
assert_eq!(B1.by(2).unwrap().half_vector().unwrap().to_string(), "b1");
|
||||||
"b1");
|
|
||||||
assert_eq!(I32.half_vector(), None);
|
assert_eq!(I32.half_vector(), None);
|
||||||
assert_eq!(VOID.half_vector(), None);
|
assert_eq!(VOID.half_vector(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_scalars() {
|
fn format_scalars() {
|
||||||
assert_eq!(format!("{}", VOID), "void");
|
assert_eq!(VOID.to_string(), "void");
|
||||||
assert_eq!(format!("{}", B1), "b1");
|
assert_eq!(B1.to_string(), "b1");
|
||||||
assert_eq!(format!("{}", B8), "b8");
|
assert_eq!(B8.to_string(), "b8");
|
||||||
assert_eq!(format!("{}", B16), "b16");
|
assert_eq!(B16.to_string(), "b16");
|
||||||
assert_eq!(format!("{}", B32), "b32");
|
assert_eq!(B32.to_string(), "b32");
|
||||||
assert_eq!(format!("{}", B64), "b64");
|
assert_eq!(B64.to_string(), "b64");
|
||||||
assert_eq!(format!("{}", I8), "i8");
|
assert_eq!(I8.to_string(), "i8");
|
||||||
assert_eq!(format!("{}", I16), "i16");
|
assert_eq!(I16.to_string(), "i16");
|
||||||
assert_eq!(format!("{}", I32), "i32");
|
assert_eq!(I32.to_string(), "i32");
|
||||||
assert_eq!(format!("{}", I64), "i64");
|
assert_eq!(I64.to_string(), "i64");
|
||||||
assert_eq!(format!("{}", F32), "f32");
|
assert_eq!(F32.to_string(), "f32");
|
||||||
assert_eq!(format!("{}", F64), "f64");
|
assert_eq!(F64.to_string(), "f64");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_vectors() {
|
fn format_vectors() {
|
||||||
assert_eq!(format!("{}", B1.by(8).unwrap()), "b1x8");
|
assert_eq!(B1.by(8).unwrap().to_string(), "b1x8");
|
||||||
assert_eq!(format!("{}", B8.by(1).unwrap()), "b8");
|
assert_eq!(B8.by(1).unwrap().to_string(), "b8");
|
||||||
assert_eq!(format!("{}", B16.by(256).unwrap()), "b16x256");
|
assert_eq!(B16.by(256).unwrap().to_string(), "b16x256");
|
||||||
assert_eq!(format!("{}", B32.by(4).unwrap().by(2).unwrap()), "b32x8");
|
assert_eq!(B32.by(4).unwrap().by(2).unwrap().to_string(), "b32x8");
|
||||||
assert_eq!(format!("{}", B64.by(8).unwrap()), "b64x8");
|
assert_eq!(B64.by(8).unwrap().to_string(), "b64x8");
|
||||||
assert_eq!(format!("{}", I8.by(64).unwrap()), "i8x64");
|
assert_eq!(I8.by(64).unwrap().to_string(), "i8x64");
|
||||||
assert_eq!(format!("{}", F64.by(2).unwrap()), "f64x2");
|
assert_eq!(F64.by(2).unwrap().to_string(), "f64x2");
|
||||||
assert_eq!(I8.by(3), None);
|
assert_eq!(I8.by(3), None);
|
||||||
assert_eq!(I8.by(512), None);
|
assert_eq!(I8.by(512), None);
|
||||||
assert_eq!(VOID.by(4), None);
|
assert_eq!(VOID.by(4), None);
|
||||||
@@ -377,24 +376,24 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn argument_type() {
|
fn argument_type() {
|
||||||
let mut t = ArgumentType::new(I32);
|
let mut t = ArgumentType::new(I32);
|
||||||
assert_eq!(format!("{}", t), "i32");
|
assert_eq!(t.to_string(), "i32");
|
||||||
t.extension = ArgumentExtension::Uext;
|
t.extension = ArgumentExtension::Uext;
|
||||||
assert_eq!(format!("{}", t), "i32 uext");
|
assert_eq!(t.to_string(), "i32 uext");
|
||||||
t.inreg = true;
|
t.inreg = true;
|
||||||
assert_eq!(format!("{}", t), "i32 uext inreg");
|
assert_eq!(t.to_string(), "i32 uext inreg");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn signatures() {
|
fn signatures() {
|
||||||
let mut sig = Signature::new();
|
let mut sig = Signature::new();
|
||||||
assert_eq!(format!("{}", sig), "()");
|
assert_eq!(sig.to_string(), "()");
|
||||||
sig.argument_types.push(ArgumentType::new(I32));
|
sig.argument_types.push(ArgumentType::new(I32));
|
||||||
assert_eq!(format!("{}", sig), "(i32)");
|
assert_eq!(sig.to_string(), "(i32)");
|
||||||
sig.return_types.push(ArgumentType::new(F32));
|
sig.return_types.push(ArgumentType::new(F32));
|
||||||
assert_eq!(format!("{}", sig), "(i32) -> f32");
|
assert_eq!(sig.to_string(), "(i32) -> f32");
|
||||||
sig.argument_types.push(ArgumentType::new(I32.by(4).unwrap()));
|
sig.argument_types.push(ArgumentType::new(I32.by(4).unwrap()));
|
||||||
assert_eq!(format!("{}", sig), "(i32, i32x4) -> f32");
|
assert_eq!(sig.to_string(), "(i32, i32x4) -> f32");
|
||||||
sig.return_types.push(ArgumentType::new(B8));
|
sig.return_types.push(ArgumentType::new(B8));
|
||||||
assert_eq!(format!("{}", sig), "(i32, i32x4) -> f32, b8");
|
assert_eq!(sig.to_string(), "(i32, i32x4) -> f32, b8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,17 +369,15 @@ mod tests {
|
|||||||
let sig2 = Parser::new("(i8 inreg uext, f32, f64) -> i32 sext, f64")
|
let sig2 = Parser::new("(i8 inreg uext, f32, f64) -> i32 sext, f64")
|
||||||
.parse_signature()
|
.parse_signature()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(format!("{}", sig2),
|
assert_eq!(sig2.to_string(),
|
||||||
"(i8 uext inreg, f32, f64) -> i32 sext, f64");
|
"(i8 uext inreg, f32, f64) -> i32 sext, f64");
|
||||||
|
|
||||||
// `void` is not recognized as a type by the lexer. It should not appear in files.
|
// `void` is not recognized as a type by the lexer. It should not appear in files.
|
||||||
assert_eq!(format!("{}",
|
assert_eq!(Parser::new("() -> void").parse_signature().unwrap_err().to_string(),
|
||||||
Parser::new("() -> void").parse_signature().unwrap_err()),
|
|
||||||
"1: expected argument type");
|
"1: expected argument type");
|
||||||
assert_eq!(format!("{}", Parser::new("i8 -> i8").parse_signature().unwrap_err()),
|
assert_eq!(Parser::new("i8 -> i8").parse_signature().unwrap_err().to_string(),
|
||||||
"1: expected function signature: ( args... )");
|
"1: expected function signature: ( args... )");
|
||||||
assert_eq!(format!("{}",
|
assert_eq!(Parser::new("(i8 -> i8").parse_signature().unwrap_err().to_string(),
|
||||||
Parser::new("(i8 -> i8").parse_signature().unwrap_err()),
|
|
||||||
"1: expected ')' after function arguments");
|
"1: expected ')' after function arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,21 +392,21 @@ mod tests {
|
|||||||
assert_eq!(func.name, "foo");
|
assert_eq!(func.name, "foo");
|
||||||
let mut iter = func.stack_slot_iter();
|
let mut iter = func.stack_slot_iter();
|
||||||
let ss0 = iter.next().unwrap();
|
let ss0 = iter.next().unwrap();
|
||||||
assert_eq!(format!("{}", ss0), "ss0");
|
assert_eq!(ss0.to_string(), "ss0");
|
||||||
assert_eq!(func[ss0].size, 13);
|
assert_eq!(func[ss0].size, 13);
|
||||||
let ss1 = iter.next().unwrap();
|
let ss1 = iter.next().unwrap();
|
||||||
assert_eq!(format!("{}", ss1), "ss1");
|
assert_eq!(ss1.to_string(), "ss1");
|
||||||
assert_eq!(func[ss1].size, 1);
|
assert_eq!(func[ss1].size, 1);
|
||||||
assert_eq!(iter.next(), None);
|
assert_eq!(iter.next(), None);
|
||||||
|
|
||||||
// Catch suplicate definitions.
|
// Catch suplicate definitions.
|
||||||
assert_eq!(format!("{}",
|
assert_eq!(Parser::new("function bar() {
|
||||||
Parser::new("function bar() {
|
|
||||||
ss1 = stack_slot 13
|
ss1 = stack_slot 13
|
||||||
ss1 = stack_slot 1
|
ss1 = stack_slot 1
|
||||||
}")
|
}")
|
||||||
.parse_function()
|
.parse_function()
|
||||||
.unwrap_err()),
|
.unwrap_err()
|
||||||
|
.to_string(),
|
||||||
"3: duplicate stack slot: ss1");
|
"3: duplicate stack slot: ss1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
src/test-all.sh
Executable file
4
src/test-all.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd $(dirname "$0")/tools
|
||||||
|
cargo test -p cretonne -p ctonfile -p cretonne-tools
|
||||||
|
cargo doc -p cretonne -p ctonfile -p cretonne-tools
|
||||||
Reference in New Issue
Block a user