mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Introduce a script::test module to expose the APIs needed for unit tests.
This commit is contained in:
parent
b843be4975
commit
86d59212fe
5 changed files with 68 additions and 22 deletions
|
@ -2,25 +2,16 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use script::dom::characterdata::CharacterData;
|
||||
use script::dom::element::Element;
|
||||
use script::dom::eventtarget::EventTarget;
|
||||
use script::dom::htmldivelement::HTMLDivElement;
|
||||
use script::dom::htmlelement::HTMLElement;
|
||||
use script::dom::htmlspanelement::HTMLSpanElement;
|
||||
use script::dom::node::Node;
|
||||
use script::dom::text::Text;
|
||||
use script::layout_wrapper::ServoThreadSafeLayoutNode;
|
||||
use std::mem::size_of;
|
||||
use script::test::size_of;
|
||||
|
||||
// Macro so that we can stringify type names
|
||||
// I'd really prefer the tests themselves to be run at plugin time,
|
||||
// however rustc::middle doesn't have access to the full type data
|
||||
macro_rules! sizeof_checker (
|
||||
($testname: ident, $t:ty, $known_size:expr) => (
|
||||
($testname: ident, $t: ident, $known_size: expr) => (
|
||||
#[test]
|
||||
fn $testname() {
|
||||
let new = size_of::<$t>();
|
||||
let new = size_of::$t();
|
||||
let old = $known_size;
|
||||
if new < old {
|
||||
panic!("Your changes have decreased the stack size of commonly used DOM struct {} from {} to {}. \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue