File tree 3 files changed +14
-9
lines changed
3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ local Case = Group:extend("LeetCase")
22
22
23
23
--- @private
24
24
--- @param input string[]
25
- function Case :input (input ) return Input (" Input" , input , self .question .q .meta_data .params ) end
25
+ function Case :input (input )
26
+ input = vim .tbl_map (utils .norm_ins , input )
27
+ return Input (" Input" , input , self .question .q .meta_data .params )
28
+ end
26
29
27
30
--- @private
28
31
--- @param output string
@@ -31,7 +34,7 @@ function Case:output(output, expected)
31
34
local key = t (" Output" )
32
35
33
36
local title = Line ():append (key , " leetcode_normal" )
34
- local pre = Pre (title , Line ():append (output ))
37
+ local pre = Pre (title , Line ():append (utils . norm_ins ( output ) ))
35
38
36
39
return pre
37
40
end
@@ -43,7 +46,7 @@ function Case:expected(expected, output)
43
46
local key = t (" Expected" )
44
47
local title = Line ():append (key , " leetcode_normal" )
45
48
46
- local pre = Pre (title , Line ():append (expected ))
49
+ local pre = Pre (title , Line ():append (utils . norm_ins ( expected ) ))
47
50
48
51
return pre
49
52
end
Original file line number Diff line number Diff line change @@ -2,16 +2,13 @@ local Pre = require("leetcode-ui.group.pre")
2
2
local t = require (" leetcode.translator" )
3
3
local Line = require (" leetcode-ui.line" )
4
4
local Lines = require (" leetcode-ui.lines" )
5
+
6
+ local utils = require (" leetcode.utils" )
5
7
local log = require (" leetcode.logger" )
6
8
7
9
--- @class lc.ui.Stdout : lc.ui.Pre
8
10
local Stdout = Pre :extend (" LeetStdout" )
9
11
10
- local function norm (str )
11
- local ins = vim .inspect (str )
12
- return ins :sub (2 , # ins - 1 )
13
- end
14
-
15
12
--- @param output string
16
13
---
17
14
--- @return lc.ui.Lines | nil
@@ -25,7 +22,7 @@ function Stdout:init(output)
25
22
26
23
local lines = Lines ()
27
24
for i = 1 , # output_list do
28
- lines :append (norm (output_list [i ])):endl ()
25
+ lines :append (utils . norm_ins (output_list [i ])):endl ()
29
26
end
30
27
31
28
local title = Line ():append ((" %s" ):format (t (" Stdout" )), " leetcode_alt" )
Original file line number Diff line number Diff line change 98
98
99
99
function utils .auth_guard () assert (config .auth .is_signed_in , " User not logged-in" ) end
100
100
101
+ function utils .norm_ins (str )
102
+ local ins = vim .inspect (str )
103
+ return ins :sub (2 , # ins - 1 )
104
+ end
105
+
101
106
return utils
You can’t perform that action at this time.
0 commit comments