summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-09-07 19:20:44 +0200
committerAraq <rumpf_a@web.de>2018-09-07 19:21:17 +0200
commitf078f272e5080d2b0983b53750e9d0b2d63c5e02 (patch)
tree892e831cd2a66d6fecc9c35ba87de4b5f1d6d578
parente06a89e11234e8882a4021d8d7cad0883c431f86 (diff)
downloadNim-f078f272e5080d2b0983b53750e9d0b2d63c5e02.tar.gz
make tests green again
-rw-r--r--appveyor.yml1
-rw-r--r--compiler/layouter.nim7
-rw-r--r--compiler/pathutils.nim11
-rw-r--r--nimpretty/nimpretty.nim6
4 files changed, 16 insertions, 9 deletions
diff --git a/appveyor.yml b/appveyor.yml
index cb4ac9e00..001c7c98f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -59,6 +59,7 @@ build_script:
 
 test_script:
   - tests\testament\tester --pedantic all -d:nimCoroutines
+  - nim c -r nimdoc\tester
 #  - koch csource
 #  - koch zip
 
diff --git a/compiler/layouter.nim b/compiler/layouter.nim
index 36ad08696..cc6ec48b7 100644
--- a/compiler/layouter.nim
+++ b/compiler/layouter.nim
@@ -9,7 +9,8 @@
 
 ## Layouter for nimpretty.
 
-import idents, lexer, lineinfos, llstream, options, msgs, strutils
+import idents, lexer, lineinfos, llstream, options, msgs, strutils,
+  pathutils
 from os import changeFileExt
 
 const
@@ -39,7 +40,7 @@ type
 
 proc openEmitter*(em: var Emitter, cache: IdentCache;
                   config: ConfigRef, fileIdx: FileIndex) =
-  let fullPath = config.toFullPath(fileIdx)
+  let fullPath = Absolutefile config.toFullPath(fileIdx)
   em.indWidth = getIndentWidth(fileIdx, llStreamOpen(fullPath, fmRead),
                                cache, config)
   if em.indWidth == 0: em.indWidth = 2
@@ -55,7 +56,7 @@ proc openEmitter*(em: var Emitter, cache: IdentCache;
 proc closeEmitter*(em: var Emitter) =
   var f = llStreamOpen(em.config.outFile, fmWrite)
   if f == nil:
-    rawMessage(em.config, errGenerated, "cannot open file: " & em.config.outFile)
+    rawMessage(em.config, errGenerated, "cannot open file: " & em.config.outFile.string)
   f.llStreamWrite em.content
   llStreamClose(f)
 
diff --git a/compiler/pathutils.nim b/compiler/pathutils.nim
index b27981159..e5317d5c3 100644
--- a/compiler/pathutils.nim
+++ b/compiler/pathutils.nim
@@ -111,11 +111,12 @@ proc canon(x: string; result: var string; state: var int) =
       # f/..
       while d > (state and 1) and result[d-1] != DirSep:
         dec d
-      setLen(result, d)
+      setLen(result, d-1)
     elif isDot(x, b):
       discard "discard the dot"
-    else:
-      if result.len > (state and 1): result.add DirSep
+    elif b[1] > b[0]:
+      if result.len > 0 and result[^1] != DirSep:
+        result.add DirSep
       result.add substr(x, b[0], b[1])
     inc state, 2
 
@@ -253,3 +254,7 @@ when isMainModule and defined(posix):
 
   doAssert AbsoluteDir"/Users/me///" / RelativeFile"z.nim" == AbsoluteFile"/Users/me/z.nim"
   doAssert relativeTo("/foo/bar.nim", "/foo/") == "bar.nim"
+
+when isMainModule and defined(windows):
+  let nasty = string(AbsoluteDir(r"C:\Users\rumpf\projects\nim\tests\nimble\nimbleDir\linkedPkgs\pkgB-#head\../../simplePkgs/pkgB-#head/") / RelativeFile"pkgA/module.nim")
+  doAssert nasty == r"C:\Users\rumpf\projects\nim\tests\nimble\nimbleDir\simplePkgs\pkgB-#head\pkgA\module.nim"
diff --git a/nimpretty/nimpretty.nim b/nimpretty/nimpretty.nim
index aa9756c45..fb2b8637f 100644
--- a/nimpretty/nimpretty.nim
+++ b/nimpretty/nimpretty.nim
@@ -12,7 +12,7 @@
 when not defined(nimpretty):
   {.error: "This needs to be compiled with --define:nimPretty".}
 
-import ../compiler / [idents, msgs, ast, syntaxes, renderer, options]
+import ../compiler / [idents, msgs, ast, syntaxes, renderer, options, pathutils]
 
 import parseopt, strutils, os
 
@@ -42,8 +42,8 @@ proc writeVersion() =
 
 proc prettyPrint(infile, outfile: string) =
   var conf = newConfigRef()
-  let fileIdx = fileInfoIdx(conf, infile)
-  conf.outFile = outfile
+  let fileIdx = fileInfoIdx(conf, AbsoluteFile infile)
+  conf.outFile = AbsoluteFile outfile
   when defined(nimpretty2):
     discard parseFile(fileIdx, newIdentCache(), conf)
   else:
=7328af20a1921d9258a60803ee5367da97a6082e'>7328af20 ^
9c1056f5 ^
a0d3cac4 ^
9c1056f5 ^
a0d3cac4 ^
695f9bf8 ^
7328af20 ^

4c37b3e9 ^
7328af20 ^



4c37b3e9 ^
a0d3cac4 ^
7328af20 ^
a0d3cac4 ^
7328af20 ^

a0d3cac4 ^



d1c9392a ^

a0d3cac4 ^




d1c9392a ^

a0d3cac4 ^






d1c9392a ^


a0d3cac4 ^



d1c9392a ^

a0d3cac4 ^





d1c9392a ^

a0d3cac4 ^




d1c9392a ^

a0d3cac4 ^





d1c9392a ^
c8a3ccbe ^



a0d3cac4 ^

c8a3ccbe ^

a0d3cac4 ^
c8a3ccbe ^




a0d3cac4 ^

c8a3ccbe ^
a0d3cac4 ^
c8a3ccbe ^


a0d3cac4 ^
d1c9392a ^

c8a3ccbe ^

a0d3cac4 ^


c8a3ccbe ^





60338448 ^
c8a3ccbe ^




60338448 ^
c8a3ccbe ^
a0d3cac4 ^
c8a3ccbe ^
a0d3cac4 ^
c8a3ccbe ^


5fe060d5 ^



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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187