Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DOMString floating point string test and fix
Fixes an issue where DOMString::is_valid_floating_point_number_string was returning true for strings that began with whitespace characters- TAB, LF, FF, or CR. Also added a unit test to cover this since the corresponding web-platform-tests are incomplete.
- Loading branch information
glowe
committed
Dec 1, 2019
1 parent
23359c5
commit 576f51f
Showing
3 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use script::test::DOMString; | ||
|
||
#[test] | ||
fn test_domstring_is_valid_floating_point_number_string_leading_whitespace() { | ||
assert!(!DOMString::from("\t1").is_valid_floating_point_number_string()); | ||
assert!(!DOMString::from("\n1").is_valid_floating_point_number_string()); | ||
// \x0C - form feed | ||
assert!(!DOMString::from("\x0C1").is_valid_floating_point_number_string()); | ||
assert!(!DOMString::from("\r1").is_valid_floating_point_number_string()); | ||
assert!(!DOMString::from(" 1").is_valid_floating_point_number_string()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters