2020-06-20 23:02:45 +00:00
|
|
|
use crate::avm1::error::Error;
|
2019-11-02 22:08:06 +00:00
|
|
|
use crate::avm1::test_utils::with_avm;
|
2019-12-06 18:24:36 +00:00
|
|
|
use crate::avm1::TObject;
|
2019-11-02 22:08:06 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn locals_into_form_values() {
|
2020-06-28 10:07:27 +00:00
|
|
|
with_avm(19, |activation, context, _this| -> Result<(), Error> {
|
2020-06-30 19:08:42 +00:00
|
|
|
let my_locals = activation.scope().locals().to_owned();
|
2020-06-28 21:07:49 +00:00
|
|
|
my_locals
|
|
|
|
.set("value1", "string".into(), activation, context)
|
|
|
|
.unwrap();
|
|
|
|
my_locals
|
|
|
|
.set("value2", 2.0.into(), activation, context)
|
|
|
|
.unwrap();
|
|
|
|
let my_local_values = activation.locals_into_form_values(context);
|
2019-11-02 22:08:06 +00:00
|
|
|
|
|
|
|
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()));
|
2020-06-20 23:02:45 +00:00
|
|
|
|
|
|
|
Ok(())
|
2019-11-02 22:08:06 +00:00
|
|
|
});
|
|
|
|
}
|