Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8d7469

Browse files
committed
Merge branch 'master' into fsharp4
Conflicts:vsintegration/src/vs/FsPkgs/FSharp.Project/Common.Source.CSharp/Project/IDEBuildLogger.cs
2 parents229e19f +4f94347 commite8d7469

File tree

10 files changed

+675
-35
lines changed

10 files changed

+675
-35
lines changed

‎src/fsharp/fsi/console.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ module Utils =
131131
typeCursor=
132132
static memberResetTo(top,left)=
133133
Utils.guard(fun()->
134-
Console.CursorTop<- top;
134+
Console.CursorTop<-mintop(Console.BufferHeight-1);
135135
Console.CursorLeft<- left)
136136
static memberMove(inset,delta)=
137137
letposition= Console.CursorTop*(Console.BufferWidth- inset)+(Console.CursorLeft- inset)+ delta
@@ -216,6 +216,7 @@ type ReadLineConsole() =
216216
if currLeft< x.Insetthen
217217
if currLeft=0then Console.Write(if promptthen x.Prompt2else String(' ',x.Inset))
218218
Utils.guard(fun()->
219+
Console.CursorTop<- min Console.CursorTop(Console.BufferHeight-1);
219220
Console.CursorLeft<- x.Inset);
220221

221222
// The caller writes the primary prompt. If we are reading the 2nd and subsequent lines of the
Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
2+
3+
namespaceUnitTests.Tests.ProjectSystem
4+
5+
// System namespaces
6+
openSystem
7+
openSystem.Collections.Generic
8+
openSystem.Globalization
9+
openSystem.IO
10+
openSystem.Text
11+
openSystem.Text.RegularExpressions
12+
13+
// VS namespaces
14+
openMicrosoft.VisualStudio.Shell
15+
openMicrosoft.VisualStudio.Shell.Interop
16+
openMicrosoft.VisualStudio.FSharp.ProjectSystem
17+
18+
// Internal unittest namespaces
19+
openNUnit.Framework
20+
openSalsa
21+
openUnitTests.TestLib.Utils.Asserts
22+
openUnitTests.TestLib.Utils.FilesystemHelpers
23+
openUnitTests.TestLib.ProjectSystem
24+
25+
[<TestFixture>]
26+
typeUpToDate()=
27+
inherit TheTests()
28+
29+
[<Test>]
30+
memberpublicthis.ItemInputs()=
31+
this.MakeProjectAndDo(["file1.fs"],[],@"
32+
<ItemGroup>
33+
<Content Include=""content.txt"" />
34+
<Resource Include=""resource.txt"" />
35+
<EmbeddedResource Include=""embedresource.txt"" />
36+
<None Include=""none.txt"" />
37+
</ItemGroup>
38+
",(fun project->
39+
letconfigNameDebug= ConfigCanonicalName("Debug","x86")
40+
letconfig= project.ConfigProvider.GetProjectConfiguration(configNameDebug)
41+
letoutput= VsMocks.vsOutputWindowPane(ref[])
42+
letlogger= OutputWindowLogger.CreateUpToDateCheckLogger(output)
43+
44+
letsourcePath= Path.Combine(project.ProjectFolder,"file1.fs")
45+
letcontentPath= Path.Combine(project.ProjectFolder,"content.txt")
46+
letresourcePath= Path.Combine(project.ProjectFolder,"resource.txt")
47+
letnonePath= Path.Combine(project.ProjectFolder,"none.txt")
48+
letembedPath= Path.Combine(project.ProjectFolder,"embedresource.txt")
49+
50+
letstartTime= DateTime.Now
51+
52+
File.AppendAllText(sourcePath,"printfn\"hello\"")
53+
File.AppendAllText(contentPath,"some content")
54+
File.AppendAllText(resourcePath,"some resource")
55+
File.AppendAllText(nonePath,"none")
56+
File.AppendAllText(embedPath,"some embedded resource")
57+
58+
Assert.IsFalse(config.IsUpToDate(logger,true))
59+
project.Build(configNameDebug, output,"Build")|> ignore
60+
Assert.IsTrue(config.IsUpToDate(logger,true))
61+
62+
// None items should not affect up-to-date
63+
File.SetLastWriteTime(nonePath, DateTime.Now.AddMinutes(5.))
64+
Assert.IsTrue(config.IsUpToDate(logger,true))
65+
66+
for pathin[sourcePath; contentPath; resourcePath; embedPath]do
67+
printfn"Testing path%s" path
68+
69+
// touch file
70+
File.SetLastWriteTime(path, DateTime.Now.AddMinutes(5.))
71+
Assert.IsFalse(config.IsUpToDate(logger,true))
72+
73+
File.SetLastWriteTime(path, startTime)
74+
Assert.IsTrue(config.IsUpToDate(logger,true))
75+
76+
// delete file
77+
letoriginalContent= File.ReadAllText(path)
78+
File.Delete(path)
79+
Assert.IsFalse(config.IsUpToDate(logger,true))
80+
81+
File.AppendAllText(path, originalContent)
82+
File.SetLastWriteTime(path, startTime)
83+
Assert.IsTrue(config.IsUpToDate(logger,true))
84+
))
85+
86+
[<Test>]
87+
memberpublicthis.PropertyInputs()=
88+
this.MakeProjectAndDo(["file1.fs"],[],@"
89+
<PropertyGroup>
90+
<VersionFile>ver.txt</VersionFile>
91+
<AssemblyOriginatorKeyFile>key.txt</AssemblyOriginatorKeyFile>
92+
</PropertyGroup>
93+
",(fun project->
94+
letconfigNameDebug= ConfigCanonicalName("Debug","x86")
95+
letconfig= project.ConfigProvider.GetProjectConfiguration(configNameDebug)
96+
letoutput= VsMocks.vsOutputWindowPane(ref[])
97+
letlogger= OutputWindowLogger.CreateUpToDateCheckLogger(output)
98+
99+
letsourcePath= Path.Combine(project.ProjectFolder,"file1.fs")
100+
letverPath= Path.Combine(project.ProjectFolder,"ver.txt")
101+
letkeyPath= Path.Combine(project.ProjectFolder,"key.txt")
102+
103+
letstartTime= DateTime.Now
104+
105+
File.AppendAllText(sourcePath,"printfn\"hello\"")
106+
File.AppendAllText(verPath,"1.2.3.4")
107+
File.AppendAllText(keyPath,"a key")
108+
109+
project.SetConfiguration(config.ConfigCanonicalName);
110+
Assert.IsFalse(config.IsUpToDate(logger,true))
111+
project.Build(configNameDebug, output,"Build")|> ignore
112+
Assert.IsTrue(config.IsUpToDate(logger,true))
113+
114+
for pathin[verPath; keyPath]do
115+
printfn"Testing path%s" path
116+
117+
// touch file
118+
File.SetLastWriteTime(path, DateTime.Now.AddMinutes(5.))
119+
Assert.IsFalse(config.IsUpToDate(logger,true))
120+
121+
File.SetLastWriteTime(path, startTime)
122+
Assert.IsTrue(config.IsUpToDate(logger,true))
123+
124+
// delete file
125+
letoriginalContent= File.ReadAllText(path)
126+
File.Delete(path)
127+
Assert.IsFalse(config.IsUpToDate(logger,true))
128+
129+
File.AppendAllText(path, originalContent)
130+
File.SetLastWriteTime(path, startTime)
131+
Assert.IsTrue(config.IsUpToDate(logger,true))
132+
))
133+
134+
[<Test>]
135+
memberpublicthis.ProjectFile()=
136+
this.MakeProjectAndDoWithProjectFile(["file1.fs"],[],"",(fun project projFileName->
137+
letconfigNameDebug= ConfigCanonicalName("Debug","x86")
138+
letconfig= project.ConfigProvider.GetProjectConfiguration(configNameDebug)
139+
letoutput= VsMocks.vsOutputWindowPane(ref[])
140+
letlogger= OutputWindowLogger.CreateUpToDateCheckLogger(output)
141+
letabsFilePath= Path.Combine(project.ProjectFolder,"file1.fs")
142+
letstartTime= DateTime.Now
143+
File.AppendAllText(absFilePath,"printfn\"hello\"")
144+
145+
Assert.IsFalse(config.IsUpToDate(logger,true))
146+
project.Build(configNameDebug, output,"Build")|> ignore
147+
Assert.IsTrue(config.IsUpToDate(logger,true))
148+
149+
// touch proj file
150+
File.SetLastWriteTime(projFileName, DateTime.Now.AddMinutes(5.))
151+
Assert.IsFalse(config.IsUpToDate(logger,true))
152+
153+
File.SetLastWriteTime(projFileName, startTime)
154+
Assert.IsTrue(config.IsUpToDate(logger,true))
155+
))
156+
157+
[<Test>]
158+
memberpublicthis.References()=
159+
letconfigNameDebug= ConfigCanonicalName("Debug","x86")
160+
letoutput= VsMocks.vsOutputWindowPane(ref[])
161+
letlogger= OutputWindowLogger.CreateUpToDateCheckLogger(output)
162+
163+
DoWithTempFile"Proj1.fsproj"(fun proj1Path->
164+
File.AppendAllText(proj1Path, TheTests.SimpleFsprojText(
165+
["File1.fs"],// <Compile>
166+
[],// <Reference>
167+
"<PropertyGroup><TargetFrameworkVersion>v4.5</TargetFrameworkVersion></PropertyGroup>"))// other stuff
168+
use project1= TheTests.CreateProject(proj1Path)
169+
letsourcePath1= Path.Combine(project1.ProjectFolder,"File1.fs")
170+
File.AppendAllText(sourcePath1,"namespace Proj1\r\n")
171+
File.AppendAllText(sourcePath1,"module Test =\r\n")
172+
File.AppendAllText(sourcePath1," let X = 5\r\n")
173+
174+
letconfig1= project1.ConfigProvider.GetProjectConfiguration(configNameDebug)
175+
176+
Assert.IsFalse(config1.IsUpToDate(logger,true))
177+
project1.Build(configNameDebug, output,"Build")|> ignore
178+
Assert.IsTrue(config1.IsUpToDate(logger,true))
179+
180+
letoutput1= Path.Combine(project1.ProjectFolder,"bin\\debug", project1.OutputFileName)
181+
182+
DoWithTempFile"Proj2.fsproj"(fun proj2Path->
183+
File.AppendAllText(proj2Path, TheTests.SimpleFsprojText(
184+
["File2.fs"],// <Compile>
185+
[output1],// <Reference>
186+
"<PropertyGroup><TargetFrameworkVersion>v4.5</TargetFrameworkVersion></PropertyGroup>"))// other stuff
187+
use project2= TheTests.CreateProject(proj2Path)
188+
letsourcePath2= Path.Combine(project2.ProjectFolder,"File2.fs")
189+
File.AppendAllText(sourcePath2,"open Proj1\r\n")
190+
File.AppendAllText(sourcePath2,"let x = Test.X")
191+
192+
letconfig2= project2.ConfigProvider.GetProjectConfiguration(configNameDebug)
193+
letstartTime= DateTime.Now
194+
195+
Assert.IsFalse(config2.IsUpToDate(logger,true))
196+
project2.Build(configNameDebug, output,"Build")|> ignore
197+
Assert.IsTrue(config2.IsUpToDate(logger,true))
198+
199+
// reference is updated
200+
File.SetLastWriteTime(output1, DateTime.Now.AddMinutes(5.))
201+
Assert.IsFalse(config2.IsUpToDate(logger,true))
202+
File.SetLastWriteTime(output1, startTime)
203+
Assert.IsTrue(config2.IsUpToDate(logger,true))
204+
205+
// reference is missing
206+
File.Delete(output1)
207+
Assert.IsFalse(config2.IsUpToDate(logger,true))
208+
)
209+
)
210+
211+
[<Test>]
212+
memberpublicthis.OutputFiles()=
213+
this.MakeProjectAndDo(["file1.fs"],[],@"
214+
<PropertyGroup>
215+
<DocumentationFile>bin\Debug\Test.XML</DocumentationFile>
216+
<DebugSymbols>true</DebugSymbols>
217+
<DebugType>full</DebugType>
218+
</PropertyGroup>",(fun project->
219+
letconfigNameDebug= ConfigCanonicalName("Debug","x86")
220+
letconfig= project.ConfigProvider.GetProjectConfiguration(configNameDebug)
221+
letoutput= VsMocks.vsOutputWindowPane(ref[])
222+
letlogger= OutputWindowLogger.CreateUpToDateCheckLogger(output)
223+
letsourcePath= Path.Combine(project.ProjectFolder,"file1.fs")
224+
225+
letexeObjPath= Path.Combine(project.ProjectFolder,"obj\\x86\\debug", project.OutputFileName)
226+
letexeBinpath= Path.Combine(project.ProjectFolder,"bin\\debug\\", project.OutputFileName)
227+
letpdbObjPath= Regex.Replace(exeObjPath,"exe$","pdb")
228+
letpdbBinPath= Regex.Replace(exeBinpath,"exe$","pdb")
229+
letxmlDocPath= Regex.Replace(exeBinpath,"exe$","xml")
230+
231+
File.AppendAllText(sourcePath,"printfn\"hello\"")
232+
233+
Assert.IsFalse(config.IsUpToDate(logger,true))
234+
project.Build(configNameDebug, output,"Build")|> ignore
235+
Assert.IsTrue(config.IsUpToDate(logger,true))
236+
237+
letstartTime= DateTime.Now
238+
239+
for pathin[exeObjPath; exeBinpath; pdbObjPath; pdbBinPath; xmlDocPath]do
240+
printfn"Testing output%s" path
241+
242+
// touch file
243+
File.SetLastWriteTime(path, DateTime.Now.AddMinutes(-5.))
244+
Assert.IsFalse(config.IsUpToDate(logger,true))
245+
246+
File.SetLastWriteTime(path, startTime)
247+
Assert.IsTrue(config.IsUpToDate(logger,true))
248+
249+
// delete file
250+
letoriginalContent= File.ReadAllBytes(path)
251+
File.Delete(path)
252+
Assert.IsFalse(config.IsUpToDate(logger,true))
253+
254+
File.WriteAllBytes(path, originalContent)
255+
File.SetLastWriteTime(path, startTime)
256+
Assert.IsTrue(config.IsUpToDate(logger,true))
257+
))
258+
259+
[<Test>]
260+
memberpublicthis.ConfigChanges()=
261+
this.MakeProjectAndDo(["file1.fs"],[],"",(fun project->
262+
letconfigNameDebugx86= ConfigCanonicalName("Debug","x86")
263+
letconfigNameReleasex86= ConfigCanonicalName("Release","x86")
264+
letconfigNameDebugAnyCPU= ConfigCanonicalName("Debug","AnyCPU")
265+
letconfigNameReleaseAnyCPU= ConfigCanonicalName("Release","AnyCPU")
266+
267+
letdebugConfigx86= project.ConfigProvider.GetProjectConfiguration(configNameDebugx86)
268+
letreleaseConfigx86= project.ConfigProvider.GetProjectConfiguration(configNameReleasex86)
269+
letdebugConfigAnyCPU= project.ConfigProvider.GetProjectConfiguration(configNameDebugAnyCPU)
270+
letreleaseConfigAnyCPU= project.ConfigProvider.GetProjectConfiguration(configNameReleaseAnyCPU)
271+
272+
letoutput= VsMocks.vsOutputWindowPane(ref[])
273+
letlogger= OutputWindowLogger.CreateUpToDateCheckLogger(output)
274+
275+
letsourcePath= Path.Combine(project.ProjectFolder,"file1.fs")
276+
File.AppendAllText(sourcePath,"printfn\"hello\"")
277+
278+
Assert.IsFalse(debugConfigx86.IsUpToDate(logger,true))
279+
Assert.IsFalse(releaseConfigx86.IsUpToDate(logger,true))
280+
Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger,true))
281+
Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger,true))
282+
283+
project.Build(configNameDebugx86, output,"Build")|> ignore
284+
Assert.IsTrue(debugConfigx86.IsUpToDate(logger,true))
285+
Assert.IsFalse(releaseConfigx86.IsUpToDate(logger,true))
286+
Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger,true))
287+
Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger,true))
288+
289+
project.Build(configNameReleasex86, output,"Build")|> ignore
290+
Assert.IsTrue(debugConfigx86.IsUpToDate(logger,true))
291+
Assert.IsTrue(releaseConfigx86.IsUpToDate(logger,true))
292+
Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger,true))
293+
Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger,true))
294+
295+
project.Build(configNameDebugAnyCPU, output,"Build")|> ignore
296+
Assert.IsTrue(debugConfigx86.IsUpToDate(logger,true))
297+
Assert.IsTrue(releaseConfigx86.IsUpToDate(logger,true))
298+
Assert.IsTrue(debugConfigAnyCPU.IsUpToDate(logger,true))
299+
Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger,true))
300+
301+
project.Build(configNameReleaseAnyCPU, output,"Build")|> ignore
302+
Assert.IsTrue(debugConfigx86.IsUpToDate(logger,true))
303+
Assert.IsTrue(releaseConfigx86.IsUpToDate(logger,true))
304+
Assert.IsTrue(debugConfigAnyCPU.IsUpToDate(logger,true))
305+
Assert.IsTrue(releaseConfigAnyCPU.IsUpToDate(logger,true))
306+
))
307+
308+
[<Test>]
309+
memberpublicthis.UTDCheckEnabled()=
310+
this.MakeProjectAndDo(["file1.fs"],[],@"
311+
<PropertyGroup>
312+
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
313+
</PropertyGroup>
314+
",(fun project->
315+
letconfigNameDebug= ConfigCanonicalName("Debug","x86")
316+
letconfig= project.ConfigProvider.GetProjectConfiguration(configNameDebug)
317+
318+
Assert.IsFalse(config.IsFastUpToDateCheckEnabled())
319+
))

‎vsintegration/src/unittests/Unittests.fsproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<CompileInclude="Tests.ProjectSystem.Project.fs" />
6363
<CompileInclude="Tests.ProjectSystem.References.fs" />
6464
<CompileInclude="Tests.ProjectSystem.RoundTrip.fs" />
65+
<CompileInclude="Tests.ProjectSystem.UpToDate.fs" />
6566
<CustomCopyLocalInclude="Unittests.dll.config">
6667
<TargetFilename>Unittests.dll.config</TargetFilename>
6768
</CustomCopyLocal>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp