File tree Expand file tree Collapse file tree 2 files changed +32
-10
lines changed
Expand file tree Collapse file tree 2 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 1- # jsondiff
1+ # jsondiff
2+
3+ Simple Json Structrual Diff Library
4+
5+ ``` mbt test
6+ let old : Json = {
7+ "foo": [1, 2, 3],
8+ "bar": { "baz": "qux" }
9+ }
10+
11+ let new : Json = {
12+ "foo": [1, 2, 4],
13+ "bar": { "baz": "quux" },
14+ "new_key": true
15+ }
16+ inspect(JsonDiff::diff_string(old, new).unwrap(), content=(
17+ #| {
18+ #|+ new_key: true
19+ #| foo: [
20+ #| 1
21+ #| 2
22+ #|- 3
23+ #|+ 4
24+ #| ]
25+ #| bar: {
26+ #|- baz: "qux"
27+ #|+ baz: "quux"
28+ #| }
29+ #| }
30+ ))
31+ ```
Original file line number Diff line number Diff line change @@ -94,15 +94,7 @@ let output_colorful_text_for_terminal : Ref[Bool] = Ref::new(false)
9494fn Array ::push_line (self : Array [String ], tag : String , line : String ) -> Unit {
9595 let tagged_line = "\{ tag } \{ line } "
9696 if output_colorful_text_for_terminal .val {
97- match tag {
98- "+" =>
99- // green
100- self .push ("\u{1b} [32m\{ tag } \{ line } \u{1b} [0m" )
101- "-" =>
102- // red
103- self .push ("\u{1b} [31m\{ tag } \{ line } \u{1b} [0m" )
104- _ => self .push (tagged_line )
105- }
97+ ...
10698 } else {
10799 self .push (tagged_line )
108100 }
You can’t perform that action at this time.
0 commit comments