mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Converted serialization methods to implement the to_css trait, writing to string buffers to save string allocations for every result
This commit is contained in:
parent
0985d7563f
commit
51e642e875
4 changed files with 132 additions and 46 deletions
|
@ -2,6 +2,7 @@
|
|||
* 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 cssparser::ToCss;
|
||||
use rustc_serialize::json::Json;
|
||||
use std::env;
|
||||
use std::fs::{File, remove_file};
|
||||
|
@ -83,10 +84,10 @@ fn property_declaration_block_should_serialize_correctly() {
|
|||
important: Arc::new(important)
|
||||
};
|
||||
|
||||
let css_string = block.serialize();
|
||||
let css_string = block.to_css_string();
|
||||
|
||||
assert_eq!(
|
||||
css_string,
|
||||
"width: 70px; min-height: 20px; display: inline-block; height: 20px ! important;"
|
||||
"width: 70px; min-height: 20px; display: inline-block; height: 20px !important;"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue