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

Commit98fc5a1

Browse files
committed
Added Unit Test for cachePath option
1 parent219ea0b commit98fc5a1

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

‎src/Dotnet.Script.Tests/ExecutionCacheTests.cs‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
usingDotnet.Script.Shared.Tests;
1+
usingDotnet.Script.Shared.Tests;
22
usingSystem;
33
usingSystem.IO;
44
usingXunit;
@@ -133,6 +133,34 @@ public void ShouldCacheScriptsFromSameFolderIndividually()
133133
Assert.False(thirdResultOfScriptB.Cached);
134134
}
135135

136+
[Fact]
137+
publicvoidShouldUseCachePathWhenProvided()
138+
{
139+
usingvarscriptFolder=newDisposableFolder();
140+
varpathToScript=Path.Combine(scriptFolder.Path,"script.csx");
141+
142+
varexecutionPathA=DependencyModel.ProjectSystem.FileUtils.GetPathToScriptTempFolder(pathToScript,cachePath:null);
143+
Assert.True(Path.IsPathFullyQualified(executionPathA));
144+
Assert.Contains("script.csx",executionPathA);
145+
146+
varfullCachePath=Path.Combine(scriptFolder.Path,"AlternateCachePath");
147+
varfullCachePathNoRoot=fullCachePath.Substring(Path.GetPathRoot(fullCachePath).Length);
148+
Assert.True(Path.IsPathFullyQualified(fullCachePath));
149+
150+
varexecutionPathB=DependencyModel.ProjectSystem.FileUtils.GetPathToScriptTempFolder(pathToScript,cachePath:fullCachePath);
151+
Assert.True(Path.IsPathFullyQualified(executionPathB));
152+
Assert.Contains("script.csx",executionPathB);
153+
Assert.Contains(fullCachePathNoRoot,executionPathB);
154+
155+
varrelativeCachePath=Path.Combine("Relative","CachePath");
156+
Assert.False(Path.IsPathRooted(relativeCachePath));
157+
158+
varexecutionPathC=DependencyModel.ProjectSystem.FileUtils.GetPathToScriptTempFolder(pathToScript,cachePath:relativeCachePath);
159+
Assert.True(Path.IsPathFullyQualified(executionPathC));
160+
Assert.Contains("script.csx",executionPathC);
161+
Assert.Contains(relativeCachePath,executionPathC);
162+
}
163+
136164
private(stringoutput,stringhash)Execute(stringpathToScript)
137165
{
138166
varresult=ScriptTestRunner.Default.Execute(pathToScript);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp