summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-01-13 19:09:00 -0800
committerGitHub <noreply@github.com>2021-01-13 19:09:00 -0800
commit7f67c593c11ea4d2c5228eb983c8f1e2cafee0e4 (patch)
tree42de979811690d3f2a726b2833cc6310f31b2311
parentfee5fbc722295a49aad4980a915ff2d41c1fa701 (diff)
downloadNim-7f67c593c11ea4d2c5228eb983c8f1e2cafee0e4.tar.gz
improve formatting of error message when runnableExamples fails (#16677)
-rw-r--r--compiler/docgen.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index f07adc428..6352ef583 100644
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -57,6 +57,11 @@ type
 
   PDoc* = ref TDocumentor ## Alias to type less.
 
+proc prettyString(a: object): string =
+  # xxx pending std/prettyprint refs https://github.com/nim-lang/RFCs/issues/203#issuecomment-602534906
+  for k, v in fieldPairs(a):
+    result.add k & ": " & $v & "\n"
+
 proc presentationPath*(conf: ConfigRef, file: AbsoluteFile, isTitle = false): RelativeFile =
   ## returns a relative file that will be appended to outDir
   let file2 = $file
@@ -480,7 +485,7 @@ proc runAllExamples(d: PDoc) =
       "docCmd", group.docCmd,
     ]
     if os.execShellCmd(cmd) != 0:
-      quit "[runnableExamples] failed: generated file: '$1' group: '$2' cmd: $3" % [outp.string, $group[], cmd]
+      quit "[runnableExamples] failed: generated file: '$1' group: '$2' cmd: $3" % [outp.string, group[].prettyString, cmd]
     else:
       # keep generated source file `outp` to allow inspection.
       rawMessage(d.conf, hintSuccess, ["runnableExamples: " & outp.string])
re?h=devel&id=c406d0b7a7d75793f88a0e560a694b4c4e18a48c'>^
ca4b971bc ^
fe0f10f6b ^
0879f0b0a ^
0879f0b0a ^
1b1bb284d ^
0879f0b0a ^

5263d9d6f ^
93e03144f ^
1b1bb284d ^





2f48dbd16 ^
0879f0b0a ^
180ab350d ^
d20a8ac68 ^
b2e486b23 ^
9af85fb69 ^
1b1bb284d ^
1dd9ec85b ^
f2f16f645 ^






ca4b971bc ^
f2f16f645 ^


f04b502cf ^

9b29436f6 ^
f04b502cf ^

5a4122dc9 ^
809a4a77a ^

e9b665f33 ^

c60bb9464 ^
e9b665f33 ^

f04b502cf ^
1b1bb284d ^
809a4a77a ^

b77ae66e8 ^
93cd98dd1 ^
5263d9d6f ^



035f0fb02 ^
8d2953e80 ^
035f0fb02 ^

8d2953e80 ^
e9b665f33 ^
a5ecbf823 ^


4a720394b ^



88b5dd336 ^
c5c6bae2a ^

e5ae7ceaa ^
6e4cd3e5b ^

e5ae7ceaa ^

1b54be777 ^

567691220 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98