1+ component extends = " org.lucee.cfml.test.LuceeTestCase" labels = " mappings" {
2+
3+ function afterAll (){
4+ application action = " update" name = " LDEV4334-reset-#CreateUniqueID () #" ;
5+ }
6+
7+ function run ( testResults , testBox ) {
8+ describe (" Testcase for LDEV4334 mappings, contractPath / ExpandPath" , function () {
9+
10+ it ( title = " check mappings" , body = function ( currentSpec ) {
11+ application action = " update" name = " LDEV4334-#CreateUniqueID () #" ;
12+ res = mappingsTest ( " LDEV4334/index.cfm" , " with no mapping" );
13+ debug (res );
14+ });
15+
16+ it ( title = " check mappings" , body = function ( currentSpec ) localmode=true {
17+ application action = " update" name = " LDEV4334-#CreateUniqueID () #" ;
18+ curr = getDirectoryFromPath ( getCurrentTemplatePath () );
19+ mappings [ " /susi" ]= curr ;
20+ application action = " update" mappings = mappings ;
21+ res = mappingsTest ( " LDEV4334/index.cfm" , " with single mapping" );
22+ debug (res );
23+ });
24+
25+ });
26+ };
27+
28+ private function mappingsTest ( required string base , required string desc ){
29+ var paths = structNew (" ordered" );
30+ paths [' desc' ] = arguments .desc ;
31+ paths [' base' ] = arguments .base ;
32+ paths [' applicationMappings' ] = serializeJson (GetApplicationSettings ().mappings );
33+ paths [' getCurrentTemplatePath()' ]= getCurrentTemplatePath ();
34+ paths [' currentFolder*getDirectoryFromPath(getCurrentTemplatePath())' ]= getDirectoryFromPath (getCurrentTemplatePath () );
35+ paths [' getContextRoot()' ] = getContextRoot ();
36+ paths [' expandPath(#paths .base #)' ] = expandPath (paths .base );
37+ paths [' expandPath( "." )' ] = expandPath ( " ." );
38+ paths [' expandPath( ".." )' ] = expandPath ( " .." );
39+ paths [' expandPath( "./" )' ] = expandPath ( " ./" );
40+ paths [' expandPath( "../" )' ] = expandPath ( " ../" );
41+ paths [' expandPath( "./" & #paths .base # )' ] = expandPath ( " ./" & paths .base );
42+ paths [' expandPath( "/" & #paths .base # )' ] = expandPath ( " /" & paths .base );
43+ paths [' contractPath( #paths .base # )' ] = contractPath ( paths .base );
44+ paths [' contractPath( "." )' ] = contractPath ( " ." );
45+ paths [' contractPath( "./" )' ] = contractPath ( " ./" );
46+ paths [' contractPath( ".." )' ] = contractPath ( " .." );
47+ paths [' contractPath( "../" )' ] = contractPath ( " ../" );
48+ paths [' contractPath( expandPath(#paths .base #) )' ] = contractPath ( expandPath (paths .base ) ) ;
49+ paths [' contractPath( expandPath( "./" & #paths .base #) )' ] = contractPath ( expandPath ( " ./" & paths .base ) );
50+ paths [' contractPath( expandPath( "/" & #paths .base # ) )' ] = contractPath ( expandPath ( " /" & paths .base ) );
51+ systemOutput (" " , true );
52+ loop collection = paths key = " local.key" value = " local.value" {
53+ systemOutput (key & chr (9 ) & value , true );
54+ }
55+ return paths ;
56+ }
57+ }
0 commit comments