Skip to content

Commit f7c4aa3

Browse files
committed
Test with local JSON files, imported with git-subtree.
1 parent 3314408 commit f7c4aa3

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

tests.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,9 @@ fn run_json_tests(json_data: &str, parse: &fn (input: ~str) -> json::Json) {
5757
}
5858

5959

60-
// JSON files are in https://github.com/SimonSapin/tinycss2/tree/master/tinycss2/tests
61-
// TODO: use git subtree or something to have them in this repository.
62-
63-
6460
#[test]
6561
fn component_value_list() {
66-
do run_json_tests(include_str!(
67-
// https://github.com/SimonSapin/tinycss2/tree/master/tinycss2/tests
68-
// TODO: use git subtree or something to have the JSON files in this repository.
69-
"../tinycss2/tinycss2/tests/component_value_list.json"
70-
)) |input| {
62+
do run_json_tests(include_str!("json-tests/component_value_list.json")) |input| {
7163
let mut parser = Parser::from_str(input);
7264
let mut results = ~[];
7365
loop {
@@ -83,7 +75,7 @@ fn component_value_list() {
8375

8476
#[test]
8577
fn one_component_value() {
86-
do run_json_tests(include_str!("../tinycss2/tinycss2/tests/one_component_value.json")) |input| {
78+
do run_json_tests(include_str!("json-tests/one_component_value.json")) |input| {
8779
let mut iter = ComponentValueIterator::from_str(input);
8880
match iter.next_non_whitespace() {
8981
None => json::List(~[json::String(~"error"), json::String(~"empty")]),
@@ -98,7 +90,7 @@ fn one_component_value() {
9890

9991
#[test]
10092
fn declaration_list() {
101-
do run_json_tests(include_str!("../tinycss2/tinycss2/tests/declaration_list.json")) |input| {
93+
do run_json_tests(include_str!("json-tests/declaration_list.json")) |input| {
10294
let mut iter = ComponentValueIterator::from_str(input);
10395
let mut declarations = ~[];
10496
loop {
@@ -117,7 +109,7 @@ fn declaration_list() {
117109

118110
#[test]
119111
fn one_declaration() {
120-
do run_json_tests(include_str!("../tinycss2/tinycss2/tests/one_declaration.json")) |input| {
112+
do run_json_tests(include_str!("json-tests/one_declaration.json")) |input| {
121113
match parse_one_declaration(&mut ComponentValueIterator::from_str(input)) {
122114
Ok(declaration) => declaration.to_json(),
123115
Err(reason) => reason.to_json(),
@@ -128,7 +120,7 @@ fn one_declaration() {
128120

129121
#[test]
130122
fn rule_list() {
131-
do run_json_tests(include_str!("../tinycss2/tinycss2/tests/rule_list.json")) |input| {
123+
do run_json_tests(include_str!("json-tests/rule_list.json")) |input| {
132124
let mut iter = ComponentValueIterator::from_str(input);
133125
let mut rules = ~[];
134126
loop {
@@ -147,7 +139,7 @@ fn rule_list() {
147139

148140
#[test]
149141
fn one_rule() {
150-
do run_json_tests(include_str!("../tinycss2/tinycss2/tests/one_rule.json")) |input| {
142+
do run_json_tests(include_str!("json-tests/one_rule.json")) |input| {
151143
match parse_one_rule(&mut ComponentValueIterator::from_str(input)) {
152144
Ok(rule) => rule.to_json(),
153145
Err(reason) => reason.to_json(),

0 commit comments

Comments
 (0)