diff options
| author | John Clements <clements@racket-lang.org> | 2013-03-13 15:30:37 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-03-20 16:05:59 -0700 |
| commit | 3cd65c233d750cd37982911602db79d29e6f5874 (patch) | |
| tree | 0e558145a765241119fa002bc7e78c8fa25f3084 /src/libsyntax/parse | |
| parent | ab8e46b0660e076e629e6775ed8da9890c5fbf1f (diff) | |
| download | rust-3cd65c233d750cd37982911602db79d29e6f5874.tar.gz rust-3cd65c233d750cd37982911602db79d29e6f5874.zip | |
change some uses of fail_unless to assert_eq
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 19 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 5 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 90f51fe9b65..e94ad0a5c17 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -779,7 +779,6 @@ pub mod test { use core::option::None; use diagnostic; use parse::token; - use util::testing::{check_equal, check_equal_ptr}; // represents a testing reader (incl. both reader and interner) struct Env { @@ -809,17 +808,17 @@ pub mod test { let tok2 = TokenAndSpan{ tok:token::IDENT(id, false), sp:span {lo:BytePos(21),hi:BytePos(23),expn_info: None}}; - check_equal (tok1,tok2); + assert_eq!(tok1,tok2); // the 'main' id is already read: - check_equal (copy string_reader.last_pos,BytePos(28)); + assert_eq!(copy string_reader.last_pos,BytePos(28)); // read another token: let tok3 = string_reader.next_token(); let tok4 = TokenAndSpan{ tok:token::IDENT(ident_interner.intern (@~"main"), false), sp:span {lo:BytePos(24),hi:BytePos(28),expn_info: None}}; - check_equal (tok3,tok4); + assert_eq!(tok3,tok4); // the lparen is already read: - check_equal (copy string_reader.last_pos,BytePos(29)) + assert_eq!(copy string_reader.last_pos,BytePos(29)) } // check that the given reader produces the desired stream @@ -828,7 +827,7 @@ pub mod test { for expected.each |expected_tok| { let TokenAndSpan {tok:actual_tok, sp: _} = env.string_reader.next_token(); - check_equal(&actual_tok,expected_tok); + assert_eq!(&actual_tok,expected_tok); } } @@ -872,21 +871,21 @@ pub mod test { let env = setup(~"'a'"); let TokenAndSpan {tok, sp: _} = env.string_reader.next_token(); - fail_unless!(tok == token::LIT_INT('a' as i64, ast::ty_char)); + assert_eq!(tok,token::LIT_INT('a' as i64, ast::ty_char)); } #[test] fn character_space() { let env = setup(~"' '"); let TokenAndSpan {tok, sp: _} = env.string_reader.next_token(); - fail_unless!(tok == token::LIT_INT(' ' as i64, ast::ty_char)); + assert_eq!(tok, token::LIT_INT(' ' as i64, ast::ty_char)); } #[test] fn character_escaped() { let env = setup(~"'\n'"); let TokenAndSpan {tok, sp: _} = env.string_reader.next_token(); - fail_unless!(tok == token::LIT_INT('\n' as i64, ast::ty_char)); + assert_eq!(tok, token::LIT_INT('\n' as i64, ast::ty_char)); } #[test] fn lifetime_name() { @@ -894,7 +893,7 @@ pub mod test { let TokenAndSpan {tok, sp: _} = env.string_reader.next_token(); let id = env.interner.intern(@~"abc"); - fail_unless!(tok == token::LIFETIME(id)); + assert_eq!(tok, token::LIFETIME(id)); } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index a133befb046..a0c73668a05 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -313,7 +313,6 @@ mod test { use std; use core::io; use core::option::None; - use util::testing::*; #[test] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str { do io::with_str_writer |writer| { @@ -327,7 +326,7 @@ mod test { @~"fn foo (x : int) { x; }", ~[], new_parse_sess(None)); - check_equal(to_json_str(@tts), + assert_eq!(to_json_str(@tts), ~"[[\"tt_tok\",[null,[\"IDENT\",[\"fn\",false]]]],\ [\"tt_tok\",[null,[\"IDENT\",[\"foo\",false]]]],\ [\"tt_delim\",[[[\"tt_tok\",[null,[\"LPAREN\",[]]]],\ @@ -347,7 +346,7 @@ mod test { @~"fn foo (x : int) { x; }", ~[],~[], new_parse_sess(None)); - check_equal(ast1,ast2); + assert_eq!(ast1,ast2); } } |
