Skip to content

Commit 9540fd7

Browse files
committed
LDEV-4642 test case for inspect once and invalid cfc falling back to cached version
https://luceeserver.atlassian.net/browse/LDEV-4642
1 parent 1f1140d commit 9540fd7

File tree

5 files changed

+91
-0
lines changed

5 files changed

+91
-0
lines changed

test/run-tests.cfm

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,30 @@ try {
3838
primary="physical"
3939
trusted="no";
4040
41+
admin
42+
action="updateMapping"
43+
type="web"
44+
password="#request.WEBADMINPASSWORD#"
45+
virtual="/test-once"
46+
physical="#request.testFolder#"
47+
toplevel="true"
48+
archive=""
49+
primary="physical"
50+
trusted="no"
51+
inspect="once";
52+
53+
admin
54+
action="updateMapping"
55+
type="web"
56+
password="#request.WEBADMINPASSWORD#"
57+
virtual="/test-never"
58+
physical="#request.testFolder#"
59+
toplevel="true"
60+
archive=""
61+
primary="physical"
62+
trusted="no"
63+
inspect="never";
64+
4165
systemOutput("set /test mapping #dateTimeFormat(now())#", true);
4266
4367
param name="testDebug" default="false";

test/tickets/LDEV4642.cfc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
component extends="org.lucee.cfml.test.LuceeTestCase" {
2+
function beforeAll() {
3+
variables.uri = createURI("LDEV4642");
4+
variables.cfc = getDirectoryFromPath( getCurrentTemplatepath() ) & "LDEV4642/test4642.cfc";
5+
variables.stashSrc= fileRead( variables.cfc );
6+
}
7+
8+
function afterAll() {
9+
fileWrite( variables.cfc, variables.stashSrc );
10+
}
11+
12+
function run( testResults , testBox ) {
13+
describe( title = "checking recompile after an error", body = function() {
14+
it( title="check recompile", body=function( currentSpec ) {
15+
var result = _InternalRequest(
16+
template : "#uri#/LDEV4642.cfm",
17+
url: {
18+
scene: "good"
19+
}
20+
);
21+
expect(result.fileContent.trim()).toBe("lucee");
22+
23+
// call the cfc, write out a bad one, try it, ignore error, try again
24+
var result = _InternalRequest(
25+
template : "#uri#/LDEV4642.cfm",
26+
url: {
27+
scene: "bad"
28+
}
29+
);
30+
expect(result.fileContent.trim()).notToBe("lucee");
31+
});
32+
});
33+
}
34+
35+
private string function createURI(string calledName) {
36+
var baseURI = "/test-once/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
37+
return baseURI&""&calledName;
38+
}
39+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
component {
2+
this.name = "ldev4642";
3+
}

test/tickets/LDEV4642/LDEV4642.cfm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<cfscript>
2+
param name = "url.scene" default = "";
3+
switch(url.scene){
4+
case "good":
5+
echo( new test4642().whoDoYouLove() );
6+
break;
7+
case "bad":
8+
try {
9+
fileWrite("test4642.cfc", "component { I love adobe!");
10+
new test4642(); // will throw, bad cfc
11+
} catch (e) {
12+
// expected to fail
13+
}
14+
// can't repo yet
15+
echo( new test4642().whoDoYouLove() ); // should be broken, faithfully returns lucee from cache
16+
break;
17+
default:
18+
throw "wuts?";
19+
}
20+
</cfscript>

test/tickets/LDEV4642/test4642.cfc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
component {
2+
function whoDoYouLove() {
3+
return "lucee";
4+
}
5+
}

0 commit comments

Comments
 (0)