This repository was archived by the owner on Dec 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +34
-7
lines changed Expand file tree Collapse file tree 3 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ build = "build.rs"
16
16
colored = " 1.5"
17
17
difference = " 1.0"
18
18
error-chain = " 0.11"
19
- rustc-serialize = " 0.3 "
19
+ serde_json = " 1.0 "
20
20
21
21
[build-dependencies ]
22
22
skeptic = " 0.13"
Original file line number Diff line number Diff line change 106
106
107
107
extern crate difference;
108
108
#[ macro_use] extern crate error_chain;
109
- extern crate rustc_serialize ;
109
+ extern crate serde_json ;
110
110
111
111
mod errors;
112
112
Original file line number Diff line number Diff line change 1
1
use std:: borrow:: Cow ;
2
- use rustc_serialize :: json :: Json ;
2
+ use serde_json ;
3
3
4
4
/// Easily construct an `Assert` with a custom command.
5
5
///
@@ -50,10 +50,8 @@ macro_rules! assert_cmd {
50
50
/// If `x` can not be decoded as `String`.
51
51
#[ doc( hidden) ]
52
52
fn deserialize_json_string ( x : & str ) -> String {
53
- match Json :: from_str ( x) . expect ( & format ! ( "Unable to deserialize `{:?}` as string." , x) ) {
54
- Json :: String ( deserialized) => deserialized,
55
- _ => panic ! ( "Unable to deserialize `{:?}` as string." , x) ,
56
- }
53
+ serde_json:: from_str ( x)
54
+ . expect ( & format ! ( "Unable to deserialize `{:?}` as string." , x) )
57
55
}
58
56
59
57
/// Deserialize a JSON-encoded `String`.
@@ -99,3 +97,32 @@ macro_rules! __assert_single_token_expression {
99
97
// little helper
100
98
( @DENY ) => { } ;
101
99
}
100
+
101
+ #[ cfg( test) ]
102
+ mod test {
103
+ use super :: * ;
104
+
105
+ #[ test]
106
+ fn flatten_unquoted ( )
107
+ {
108
+ assert_eq ! (
109
+ flatten_escaped_string( "hello world" ) ,
110
+ "hello world" ) ;
111
+ }
112
+
113
+ #[ test]
114
+ fn flatten_quoted ( )
115
+ {
116
+ assert_eq ! (
117
+ flatten_escaped_string( r#""hello world""# ) ,
118
+ "hello world" ) ;
119
+ }
120
+
121
+ #[ test]
122
+ fn flatten_escaped ( )
123
+ {
124
+ assert_eq ! (
125
+ flatten_escaped_string( r#""hello world \u0042 A""# ) ,
126
+ "hello world B A" ) ;
127
+ }
128
+ }
You can’t perform that action at this time.
0 commit comments