use crate::tests::bc::golden::bc_golden_test;
#[test]
fn test_methods_invoked_speculatively() {
bc_golden_test(
"speculative_exec_methods_invoked_speculatively",
r#"
def test():
return "foo".startswith("f")
"#,
)
}
#[test]
fn test_format_speculatively_before_format_instr() {
bc_golden_test(
"speculative_exec_format_speculatively_before_format_instr",
r#"
def test():
# Test this expression is compiled to constant, not to `FormatOne` instruction.
return "x{}y".format(1)
"#,
);
}
#[test]
fn test_speculatively_inline_enum() {
bc_golden_test(
"speculative_exec_enum_inline",
r#"
MyEnum = enum("red", "green", "blue")
def test(x):
# Test there is no enum evaluation.
return x == MyEnum("red")
"#,
);
}