1
- using System . IO ;
1
+ using System ;
2
+ using System . IO ;
2
3
using System . Linq ;
3
4
using Microsoft . VisualStudio . TestTools . UnitTesting ;
4
5
using WebCompiler ;
@@ -25,6 +26,8 @@ public void Cleanup()
25
26
File . Delete ( "../../artifacts/less/error.css" ) ;
26
27
File . Delete ( "../../artifacts/less/relative.css" ) ;
27
28
File . Delete ( "../../artifacts/less/relative.min.css" ) ;
29
+ File . Delete ( "../../artifacts/less/circrefa.css" ) ;
30
+ File . Delete ( "../../artifacts/less/circrefa.min.css" ) ;
28
31
}
29
32
30
33
[ TestMethod , TestCategory ( "LESS" ) ]
@@ -92,6 +95,19 @@ public void OtherExtensionTypeSourceFileChangedTest()
92
95
}
93
96
94
97
[ TestMethod , TestCategory ( "LESS" ) ]
98
+ public void CompileCircularReference ( )
99
+ {
100
+ // Set the last write time and create outputs in a way that Config.CheckForNewerDependenciesRecursively will be called
101
+ File . SetLastWriteTimeUtc ( "../../artifacts/less/circrefa.less" , DateTime . UtcNow ) ;
102
+ File . SetLastWriteTimeUtc ( "../../artifacts/less/circrefb.less" , DateTime . UtcNow ) ;
103
+ File . WriteAllText ( "../../artifacts/less/circrefa.css" , string . Empty ) ;
104
+ File . WriteAllText ( "../../artifacts/less/circrefa.min.css" , string . Empty ) ;
105
+
106
+ // Since the outputs were generated after the inputs, no compilation should have occurred
107
+ var result = _processor . Process ( "../../artifacts/lessconfigCircRef.json" ) ;
108
+ Assert . AreEqual ( 0 , result . Count < CompilerResult > ( ) ) ;
109
+ }
110
+
95
111
public void CompileLessLegacyStrictMath ( )
96
112
{
97
113
var result = _processor . Process ( "../../artifacts/lessconfigLegacyStrictMath.json" ) ;
0 commit comments