Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit e94a360

Browse files
committed
Fix Alloc error in raise_3 test
1 parent f053a08 commit e94a360

File tree

1 file changed

+45
-43
lines changed

1 file changed

+45
-43
lines changed

lumen_runtime/src/otp/erlang/tests/raise_3/with_atom_class.rs

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -487,55 +487,57 @@ fn with_mfa_with_positive_line_raises() {
487487

488488
#[test]
489489
fn with_mfa_with_file_and_line_raises() {
490-
with_process_arc(|arc_process| {
491-
TestRunner::new(Config::with_source_file(file!()))
492-
.run(
493-
&(
490+
TestRunner::new(Config::with_source_file(file!()))
491+
.run(
492+
&strategy::process().prop_flat_map(|arc_process| {
493+
(
494+
Just(arc_process.clone()),
494495
class_variant_and_term(),
495496
strategy::term(arc_process.clone()),
496497
strategy::term::atom(),
497498
strategy::term::atom(),
498499
strategy::term::function::arity_or_arguments(arc_process.clone()),
499500
strategy::term::charlist(arc_process.clone()),
500-
strategy::term::integer::positive(arc_process.clone()),
501-
),
502-
|(
503-
(class_variant, class),
504-
reason,
505-
module,
506-
function,
507-
arity_or_arguments,
508-
file_value,
509-
line_value,
510-
)| {
511-
let file_key = atom_unchecked("file");
512-
let line_key = atom_unchecked("line");
513-
let location = arc_process
514-
.list_from_slice(&[
515-
arc_process
516-
.tuple_from_slice(&[file_key, file_value])
517-
.unwrap(),
518-
arc_process
519-
.tuple_from_slice(&[line_key, line_value])
520-
.unwrap(),
521-
])
522-
.unwrap();
523-
let stacktrace = arc_process
524-
.list_from_slice(&[arc_process
525-
.tuple_from_slice(&[module, function, arity_or_arguments, location])
526-
.unwrap()])
527-
.unwrap();
528-
529-
prop_assert_eq!(
530-
erlang::raise_3(class, reason, stacktrace),
531-
Err(raise!(class_variant, reason, Some(stacktrace)).into())
532-
);
533-
534-
Ok(())
535-
},
536-
)
537-
.unwrap();
538-
});
501+
strategy::term::integer::positive(arc_process),
502+
)
503+
}),
504+
|(
505+
arc_process,
506+
(class_variant, class),
507+
reason,
508+
module,
509+
function,
510+
arity_or_arguments,
511+
file_value,
512+
line_value,
513+
)| {
514+
let file_key = atom_unchecked("file");
515+
let line_key = atom_unchecked("line");
516+
let location = arc_process
517+
.list_from_slice(&[
518+
arc_process
519+
.tuple_from_slice(&[file_key, file_value])
520+
.unwrap(),
521+
arc_process
522+
.tuple_from_slice(&[line_key, line_value])
523+
.unwrap(),
524+
])
525+
.unwrap();
526+
let stacktrace = arc_process
527+
.list_from_slice(&[arc_process
528+
.tuple_from_slice(&[module, function, arity_or_arguments, location])
529+
.unwrap()])
530+
.unwrap();
531+
532+
prop_assert_eq!(
533+
erlang::raise_3(class, reason, stacktrace),
534+
Err(raise!(class_variant, reason, Some(stacktrace)).into())
535+
);
536+
537+
Ok(())
538+
},
539+
)
540+
.unwrap();
539541
}
540542

541543
fn class() -> BoxedStrategy<Term> {

0 commit comments

Comments
 (0)