From 97bda804d2abaa3eda114dbe1fb9dcb18d09ea6b Mon Sep 17 00:00:00 2001 From: You Guang Date: Fri, 16 Aug 2024 13:10:21 +0800 Subject: [PATCH] revert cram test to follow main --- test/cram/test.t | 124 +++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/test/cram/test.t b/test/cram/test.t index 9fe8dfd..e96fbb8 100644 --- a/test/cram/test.t +++ b/test/cram/test.t @@ -21,28 +21,28 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n Operation 2 of 14, 1 hunk 3 additions, 1 removal Modification of bin/main.ml @@ -1,7 +1,9 @@ - 1 1 open Diffcessible - 2 2 - 3 3 let main () = - 4 - Interactive_viewer.start () - 4 + let s = In_channel.input_all In_channel.stdin in let patch = Patch.to_diffs s in Interactive_viewer.start patch - 5 5 - 6 6 open Cmdliner - 7 7 + 1 1 open Diffcessible + 2 2 + 3 3 let main () = + 4 - Interactive_viewer.start () + 4 + let s = In_channel.input_all In_channel.stdin in + 5 + let patch = Patch.to_diffs s in + 6 + Interactive_viewer.start patch + 5 7 + 6 8 open Cmdliner + 7 9 - - - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n Operation 3 of 14, 1 hunk 1 addition, 1 removal @@ -63,7 +63,7 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff h Help Panel: @@ -90,8 +90,9 @@ This is a cram test for the new executable. 2 additions, 1 removal Modification of file.txt @@ -2,1 +2,2 @@ - 1 - Hi everyone! - 1 + Hello World! This is the diffcessible project. + 2 - Hi everyone! + 2 + Hello World! + 3 + This is the diffcessible project. @@ -104,16 +105,15 @@ This is a cram test for the new executable. - - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal more-examples.diff n Operation 2 of 2, 1 hunk 2 additions, 1 removal Modification of file.txt @@ -3,1 +5,2 @@ - 1 - This file starts at line 3. - 1 + This file starts at line 5. This is the second test case in this file. - + 3 - This file starts at line 3. + 5 + This file starts at line 5. + 6 + This is the second test case in this file. @@ -126,7 +126,7 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. @@ -139,8 +139,8 @@ This is a cram test for the new executable. 2 additions, 1 removal Modification of file.txt @@ -2,1 @@ @@ +2,2 @@ - 1 Hi everyone! 1 Hello World! - 2 This is the diffcessible project. + 1 - Hi everyone! 1 + Hello World! + 2 + This is the diffcessible project. @@ -154,15 +154,15 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal more-examples.diff n t Operation 2 of 2, 1 hunk 2 additions, 1 removal Modification of file.txt @@ -3,1 @@ @@ +5,2 @@ - 1 This file starts at line 3. 1 This file starts at line 5. - 2 This is the second test case in this file. + 1 - This file starts at line 3. 1 + This file starts at line 5. + 2 + This is the second test case in this file. @@ -176,7 +176,7 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n t Operation 3 of 14, 1 hunk @@ -185,7 +185,7 @@ This is a cram test for the new executable. @@ -1,3 @@ @@ +1,3 @@ 1 (library 1 (library 2 (name diffcessible) 2 (name diffcessible) - 3 (libraries notty nottui lwd)) 3 (libraries notty nottui lwd patch)) + 3 - (libraries notty nottui lwd)) 3 + (libraries notty nottui lwd patch)) @@ -198,7 +198,7 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n t Operation 4 of 14, 1 hunk @@ -207,20 +207,20 @@ This is a cram test for the new executable. @@ -1,39 @@ @@ +1,25 @@ 1 open Nottui 1 open Nottui 2 module W = Nottui_widgets 2 module W = Nottui_widgets - 3 open Lwd_infix 3 (* open Lwd_infix *) - 4 - 5 type patch = unit + 3 - open Lwd_infix 3 + (* open Lwd_infix *) + 4 - + 5 - type patch = unit 6 4 7 let pure_str s = Lwd.pure (W.string s) 5 let pure_str s = Lwd.pure (W.string s) - 8 - 9 let string_of_counter c = - 10 let$ c = c in - 11 W.string (string_of_int c) - 12 + 8 - + 9 - let string_of_counter c = + 10 - let$ c = c in + 11 - W.string (string_of_int c) + 12 - 13 let quit = Lwd.var false 6 let quit = Lwd.var false - 14 let counter = Lwd.var 0 7 let string_of_operation = Format.asprintf "%a" (Patch.pp_operation ~gi - 15 let counter_d = Lwd.get counter - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + 14 - let counter = Lwd.var 0 7 + let string_of_operation = Format.asprintf "%a" (Patch.pp_operation ~ + 15 - let counter_d = Lwd.get counter + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n t @@ -230,9 +230,9 @@ This is a cram test for the new executable. @@ -1,5 @@ @@ +1,3 @@ 1 (** Render and navigate through a diff. *) 1 (** Render and navigate through a diff. *) 2 2 - 3 type patch = unit 3 val start : Patch.t list -> unit - 4 - 5 val start : patch -> unit + 3 - type patch = unit 3 + val start : Patch.t list -> unit + 4 - + 5 - val start : patch -> unit @@ -243,7 +243,7 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n n t @@ -251,7 +251,7 @@ This is a cram test for the new executable. 1 addition, 1 removal Rename with modifications dir1/file.txt to dir2/file.txt @@ -1,1 @@ @@ +1,1 @@ - 1 This is the original content. 1 This is the modified content. + 1 - This is the original content. 1 + This is the modified content. @@ -266,15 +266,15 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n n n n t Operation 8 of 14, 1 hunk 2 additions, 1 removal Rename with modifications dir1/file.txt to dir2/file.txt @@ -1,1 @@ @@ +1,2 @@ - 1 This is the original content. 1 Here is some additional line. - 2 Deleted line 1 and added this. + 1 - This is the original content. 1 + Here is some additional line. + 2 + Deleted line 1 and added this. @@ -288,14 +288,14 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n n n n n n t Operation 10 of 14, 1 hunk 0 additions, 1 removal Deletion of dir1/file.txt - @@ -1,1 @@ @@ +1,0 @@ - 1 some text + @@ -1,1 @@ @@ +0,0 @@ + 1 - some text @@ -310,15 +310,15 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n n n n n n n n n t Operation 13 of 14, 1 hunk 2 additions, 0 removals Creation of dir2/sample.txt - @@ -1,0 @@ @@ +1,2 @@ - 1 some text - 2 lorem ipsum + @@ -0,0 @@ @@ +1,2 @@ + 1 + some text + 2 + lorem ipsum @@ -332,14 +332,14 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n n n n n n n n n n n n t Operation 14 of 14, 1 hunk 1 addition, 0 removals Rename with modifications dir1/file.txt to dir2/file.txt - @@ -1,0 @@ @@ +1,1 @@ - 1 new text + @@ -0,0 @@ @@ +1,1 @@ + 1 + new text @@ -354,15 +354,15 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode. $ dummy_terminal example.diff n n n n n n n n n n n n n n n n t Operation 14 of 14, 1 hunk 1 addition, 0 removals Rename with modifications dir1/file.txt to dir2/file.txt - @@ -1,0 @@ @@ +1,1 @@ - 1 new text + @@ -0,0 @@ @@ +1,1 @@ + 1 + new text @@ -377,7 +377,7 @@ This is a cram test for the new executable. - [h]elp [q]uit [n/p]avigate [t]oggle view [r]ender mode + Type 'h' to go to the help panel, 'q' to quit, 'n' to go to the next operation, 'p' to go to the previous operation. Press 't' to toggle view mode.