Skip to content

Commit 8e13621

Browse files
Lord-McSweeneyLord-McSweeney
Lord-McSweeney
authored andcommitted
avm1: Remove unit tests for debugger
This is the last place static strings are being used in tests, and the debugger is not used much anyway
1 parent aeef001 commit 8e13621

File tree

1 file changed

+0
-121
lines changed

1 file changed

+0
-121
lines changed

core/src/avm1/debug.rs

-121
Original file line numberDiff line numberDiff line change
@@ -188,124 +188,3 @@ impl<'a> VariableDumper<'a> {
188188
self.output.push('\n');
189189
}
190190
}
191-
192-
#[cfg(test)]
193-
mod tests {
194-
use super::*;
195-
use crate::avm1::error::Error;
196-
use crate::avm1::test_utils::with_avm;
197-
use crate::avm1::ScriptObject;
198-
199-
#[test]
200-
fn dump_undefined() {
201-
with_avm(19, |activation, _root| -> Result<(), Error> {
202-
assert_eq!(
203-
VariableDumper::dump(&Value::Undefined, " ", activation),
204-
"undefined"
205-
);
206-
Ok(())
207-
})
208-
}
209-
210-
#[test]
211-
fn dump_null() {
212-
with_avm(19, |activation, _root| -> Result<(), Error> {
213-
assert_eq!(VariableDumper::dump(&Value::Null, " ", activation), "null");
214-
Ok(())
215-
})
216-
}
217-
218-
#[test]
219-
fn dump_bool() {
220-
with_avm(19, |activation, _root| -> Result<(), Error> {
221-
assert_eq!(VariableDumper::dump(&true.into(), " ", activation), "true");
222-
assert_eq!(
223-
VariableDumper::dump(&false.into(), " ", activation),
224-
"false"
225-
);
226-
Ok(())
227-
})
228-
}
229-
230-
#[test]
231-
fn dump_number() {
232-
with_avm(19, |activation, _root| -> Result<(), Error> {
233-
assert_eq!(VariableDumper::dump(&1000.into(), " ", activation), "1000");
234-
assert_eq!(
235-
VariableDumper::dump(&(-0.05).into(), " ", activation),
236-
"-0.05"
237-
);
238-
Ok(())
239-
})
240-
}
241-
242-
#[test]
243-
fn dump_string() {
244-
with_avm(19, |activation, _root| -> Result<(), Error> {
245-
assert_eq!(VariableDumper::dump(&"".into(), " ", activation), "\"\"");
246-
assert_eq!(
247-
VariableDumper::dump(&"HELLO WORLD".into(), " ", activation),
248-
"\"HELLO WORLD\""
249-
);
250-
assert_eq!(
251-
VariableDumper::dump(
252-
&"Escape \"this\" string\nplease! \u{0008}\u{000C}\n\r\t\"\\".into(),
253-
" ",
254-
activation,
255-
),
256-
"\"Escape \\\"this\\\" string\\nplease! \\b\\f\\n\\r\\t\\\"\\\\\""
257-
);
258-
Ok(())
259-
})
260-
}
261-
262-
#[test]
263-
fn dump_empty_object() {
264-
with_avm(19, |activation, _root| -> Result<(), Error> {
265-
let object = ScriptObject::new(activation.strings(), None);
266-
assert_eq!(
267-
VariableDumper::dump(&object.into(), " ", activation),
268-
"[object #0] {}"
269-
);
270-
Ok(())
271-
})
272-
}
273-
274-
#[test]
275-
fn dump_object() {
276-
with_avm(19, |activation, _root| -> Result<(), Error> {
277-
let object = ScriptObject::new(activation.strings(), None);
278-
let child = ScriptObject::new(activation.strings(), None);
279-
object.set("self", object.into(), activation)?;
280-
object.set("test", "value".into(), activation)?;
281-
object.set("child", child.into(), activation)?;
282-
child.set("parent", object.into(), activation)?;
283-
child.set("age", 6.into(), activation)?;
284-
assert_eq!(
285-
VariableDumper::dump(&object.into(), " ", activation),
286-
"[object #0] {\n child: [object #1] {\n age: 6\n parent: [object #0]\n }\n test: \"value\"\n self: [object #0]\n}",
287-
);
288-
Ok(())
289-
})
290-
}
291-
292-
#[test]
293-
fn dump_variables() {
294-
with_avm(19, |activation, _root| -> Result<(), Error> {
295-
let object = ScriptObject::new(activation.strings(), None);
296-
let child = ScriptObject::new(activation.strings(), None);
297-
object.set("self", object.into(), activation)?;
298-
object.set("test", "value".into(), activation)?;
299-
object.set("child", child.into(), activation)?;
300-
child.set("parent", object.into(), activation)?;
301-
child.set("age", 6.into(), activation)?;
302-
let mut dumper = VariableDumper::new(" ");
303-
dumper.print_variables("Variables:", "object", &object.into(), activation);
304-
assert_eq!(
305-
dumper.output,
306-
"Variables:\nobject.child = [object #0] {\n age: 6\n parent: [object #1] {\n child: [object #0]\n test: \"value\"\n self: [object #1]\n }\n }\nobject.test = \"value\"\nobject.self = [object #1]\n\n"
307-
);
308-
Ok(())
309-
})
310-
}
311-
}

0 commit comments

Comments
 (0)