2019-11-02 22:08:06 +00:00
|
|
|
use crate::avm1::activation::Activation;
|
|
|
|
use crate::avm1::test_utils::with_avm;
|
2019-12-06 18:24:36 +00:00
|
|
|
use crate::avm1::TObject;
|
2019-10-21 22:37:04 +00:00
|
|
|
use gc_arena::GcCell;
|
2019-11-02 22:08:06 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn locals_into_form_values() {
|
|
|
|
with_avm(19, |avm, context, _this| {
|
|
|
|
let my_activation =
|
|
|
|
Activation::from_nothing(19, avm.global_object_cell(), context.gc_context);
|
2019-12-06 18:24:36 +00:00
|
|
|
let my_locals = my_activation.scope().locals().to_owned();
|
2019-11-02 22:08:06 +00:00
|
|
|
|
|
|
|
my_locals
|
2019-10-25 03:21:35 +00:00
|
|
|
.set("value1", "string".into(), avm, context, my_locals)
|
2019-10-26 03:21:14 +00:00
|
|
|
.unwrap();
|
2019-11-02 22:08:06 +00:00
|
|
|
my_locals
|
2019-10-25 03:21:35 +00:00
|
|
|
.set("value2", 2.0.into(), avm, context, my_locals)
|
2019-10-26 03:21:14 +00:00
|
|
|
.unwrap();
|
2019-11-02 22:08:06 +00:00
|
|
|
|
2019-10-21 22:37:04 +00:00
|
|
|
avm.insert_stack_frame(GcCell::allocate(context.gc_context, my_activation));
|
2019-11-02 22:08:06 +00:00
|
|
|
|
|
|
|
let my_local_values = avm.locals_into_form_values(context);
|
|
|
|
|
|
|
|
assert_eq!(my_local_values.len(), 2);
|
|
|
|
assert_eq!(my_local_values.get("value1"), Some(&"string".to_string()));
|
|
|
|
assert_eq!(my_local_values.get("value2"), Some(&"2".to_string()));
|
|
|
|
});
|
|
|
|
}
|