Skip to content

Commit

Permalink
Test cases added (AddTatinDependencies) and improved (NuGet-related)
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Jun 21, 2024
1 parent b12f811 commit d417e68
Show file tree
Hide file tree
Showing 19 changed files with 301 additions and 122 deletions.
4 changes: 3 additions & 1 deletion APLSource/Cider/History.apla
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
(
'* 0.41.0 ⋄ 2024-06-20'
'* 0.41.0 ⋄ 2024-06-21'
' * API functions `CreateProject` and `CreateCreateProjectParms` added '
' * Cider now adds its own version number to a project config file whenever it is written to disk'
' * Cider''s "Make" now re-creates the UCMD cache'
' * Test cases added for ]addTatinDependencies'
' * NuGet-related test cases of the UC-group improved'
'* 0.40.1 ⋄ 2024-06-18'
' * NuGet-related test cases are now executed in their own, independent process'
' * Error messages for `Init` functions of a project improved'
Expand Down
2 changes: 1 addition & 1 deletion APLSource/Cider/Version.aplf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rVersion
See also `History`
r'0.41.0-beta-4+671'
r'0.41.0-beta-5+671'
1 change: 1 addition & 0 deletions APLSource/TestCases/Test_NuGet_001.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RTest_NuGet_001(stopFlag batchFlag);⎕TRAP;parms;I;tempFolder;msg;rc
Open a project with no dependencies, add a NuGet dependency, close and reopen
The real test function (∆Test_NuGet_001) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

Expand Down
1 change: 1 addition & 0 deletions APLSource/TestCases/Test_NuGet_002.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RTest_NuGet_002(stopFlag batchFlag);⎕TRAP;parms;I;tempFolder;msg;rc
Open a project, add two NuGet dependencies, load, call, list, close, re-open, close
The real test function (∆Test_NuGet_002) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

Expand Down
1 change: 1 addition & 0 deletions APLSource/TestCases/Test_NuGet_003.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RTest_NuGet_003(stopFlag batchFlag);⎕TRAP;parms;I;tempFolder;msg;rc
Open a project which has a Tatin dependency, add a NuGet package, close and reopen
The real test function (∆Test_NuGet_003) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

Expand Down
1 change: 1 addition & 0 deletions APLSource/TestCases/Test_NuGet_004.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RTest_NuGet_004(stopFlag batchFlag);⎕TRAP;parms;I;tempFolder;msg;rc
Open a project, add two NuGet dependencies with a target namespace, load, call, list, close, re-open, close
The real test function (∆Test_NuGet_004) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

Expand Down
41 changes: 8 additions & 33 deletions APLSource/TestCases/Test_UC_045.aplf
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
RTest_UC_045(stopFlag batchFlag);⎕TRAP;res;msg;rc;folder;parms;tempDir;success;log
RTest_UC_045(stopFlag batchFlag);⎕TRAP;tempFolder;parms;I;rc;msg
Exercise ]Cider.AddNuGetDependencies and ListNuGetDependencies
The real test function (∆Test_UC_045) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If 1 122500 We need .NET Core and a successfully loaded .NET bridge
RT._NotApplicable 0
:EndIf

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
tempDir ⎕NCOPY1folder,'/*'

parms##.Cider.CreateOpenParms''
parms.folder⎕NPARTS tempDir
parms.noPkgLoad0
parms.batch1
parms.ignoreUserExec1

##.Cider.C.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
(success log)##.Cider.OpenProject parms
T.GoToTidyUp~success
T.GoToTidyUp/'ERROR'log

{}##.Cider.AddNuGetDependencies'Clock,NodaTime'tempDir Clock is already installed

(rc msg res)∆UCMD'ListNuGetDependencies "',tempDir,'"'
T.PassesIf rc=0
T.PassesIf 0=msg
T.PassesIf 2=res
T.PassesIf 2=2res

RT._OK
tempFolder∆GetFolderInTempDir⎕SI
parms∆NuGetTestProcessParms(⎕SI)tempFolder
I⎕NEW APLProcess(,parms)
RI.ExitCode

∆TidyUp:
##.Cider.C.Cleanup
{}∆LINK'Break' '#.TEMP'
FilesAndDirs.RmDir tempDir,'/..' Does not work: the .NET DLL blocks this; there is no way around this at the time of writing (October 2023)
(rc msg)FilesAndDirs.RmDirByForce tempFolder
msg Assert 0=rc
Done
42 changes: 42 additions & 0 deletions APLSource/TestCases/Test_UC_046.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
RTest_UC_046(stopFlag batchFlag);⎕TRAP;res;msg;rc;folder;parms;tempDir;success;log;stop;expected
Exercise ]Cider.AddTatinDependencies and ListTatinDependencies
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
tempDir ⎕NCOPY1folder,'/*'

parms##.Cider.CreateOpenParms''
parms.folder⎕NPARTS tempDir
parms.noPkgLoad0
parms.batch1
parms.ignoreUserExec1

##.Cider.C.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
(success log)##.Cider.OpenProject parms
T.GoToTidyUp~success
T.GoToTidyUp/'ERROR'log

stop0
##.Cider.C.YesOrNo_Answers1 2'AddTatinDeps@' 'y'
##.Cider.C.YesOrNo_Answers'LoadTatinDependenciesAfterAdding@' 'y'
(rc msg res)stop ∆UCMD'AddTatinDependencies FilesAndDirs,APLTreeUtils2 "',tempDir,'"'
T.GoToTidyUp rc0
T.GoToTidyUp 0msg
expected'2 Tatin dependencies added:' 'aplteam-FilesAndDirs-5.7.1' 'aplteam-APLTreeUtils2-1.4.0' '2 dependencies were loaded'
T.GoToTidyUp expectedAPLTreeUtils2.DLB,res

(rc msg res)stop ∆UCMD'ListTatinDependencies "',tempDir,'" -raw' Nothing was installed earlier
T.GoToTidyUp rc0
T.GoToTidyUp 0msg
T.GoToTidyUp 2+/res[;3]

RT._OK

∆TidyUp:
##.Cider.C.Cleanup
{}∆LINK'Break' '#.TEMP'
FilesAndDirs.RmDir tempDir,'/..'
Done
37 changes: 37 additions & 0 deletions APLSource/TestCases/Test_UC_047.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
RTest_UC_047(stopFlag batchFlag);⎕TRAP;res;msg;rc;folder;parms;tempDir;success;log;stop;expected
Exercise ]Cider.AddTatinDependencies without loading
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
tempDir ⎕NCOPY1folder,'/*'

parms##.Cider.CreateOpenParms''
parms.folder⎕NPARTS tempDir
parms.noPkgLoad0
parms.batch1
parms.ignoreUserExec1

##.Cider.C.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
(success log)##.Cider.OpenProject parms
T.GoToTidyUp~success
T.GoToTidyUp/'ERROR'log

stop0
##.Cider.C.YesOrNo_Answers1 2'AddTatinDeps@' 'y'
##.Cider.C.YesOrNo_Answers'LoadTatinDependenciesAfterAdding@' 'n'
(rc msg res)stop ∆UCMD'AddTatinDependencies FilesAndDirs,APLTreeUtils2 "',tempDir,'"'
T.GoToTidyUp rc0
T.GoToTidyUp 0msg
expected'2 Tatin dependencies added:' 'aplteam-FilesAndDirs-5.7.1' 'aplteam-APLTreeUtils2-1.4.0'
T.GoToTidyUp expectedAPLTreeUtils2.DLB,res

RT._OK

∆TidyUp:
##.Cider.C.Cleanup
{}∆LINK'Break' '#.TEMP'
FilesAndDirs.RmDir tempDir,'/..'
Done
51 changes: 8 additions & 43 deletions APLSource/TestCases/Test_UC_050.aplf
Original file line number Diff line number Diff line change
@@ -1,50 +1,15 @@
RTest_UC_050(stopFlag batchFlag);⎕TRAP;folder;res;log;cals;success;tempDir;config;msg;rc;stop;batch;Cleanup;ref
RTest_UC_050(stopFlag batchFlag);⎕TRAP;tempFolder;parms;I;rc;msg
Open project, add 2 NuGet packages to default folder, load, call, list, close, re-open, close
The real test function (∆Test_UC_050) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If 1 122500 We need .NET Core and a successfully loaded .NET bridge
RT._NotApplicable 0
:EndIf

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
tempDir ⎕NCOPY1folder,'/*'

ref∆GetRefToCommTools
ref.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
stop0
(rc msg res)stop ∆UCMD'OpenProject ',tempDir,' -projectSpace=TEMP -batch -ignoreUserExec'
Assert rc=0

ref.YesOrNo_Answers1 2'LoadNuGetDependenciesAfterAdding@' 'y'
(rc msg res)stop ∆UCMD'AddNuGetDependencies Clock,NodaTime ',tempDir
Assert rc=0
T.GoToTidyUp 2+/'Clock' 'NodaTime'{0<('\b',,'\b')⎕S 0}¨res

(rc msg res)stop ∆UCMD'ListNuGetDependencies ',tempDir
Assert rc=0
T.GoToTidyUp 2res

(rc msg res)∆UCMD'CloseProject ',tempDir,' fast'
Assert rc=0
T.GoToTidyUp'Number of projects closed: 1'res

#.TEMP.(⎕EX ⎕NL-9)
(rc msg res)stop ∆UCMD'OpenProject ',tempDir,' -projectSpace=TEMP -batch -ignoreUserExec'
Assert rc=0
T.GoToTidyUp'Project successfully opened and established in "#.TEMP"'res~⎕TC
T.GoToTidyUp~('UtcNow')#.TEMP.Clock.⎕NL-2
T.GoToTidyUp~/'Julian' 'Gregorian'¨#.TEMP.NodaTime.CalendarSystem.⎕NL-2

(rc msg res)∆UCMD'CloseProject ',tempDir,' -fast'
Assert rc=0

RT._OK
tempFolder∆GetFolderInTempDir⎕SI
parms∆NuGetTestProcessParms(⎕SI)tempFolder
I⎕NEW APLProcess(,parms)
RI.ExitCode

∆TidyUp:
ref.Cleanup
res∆LINK'Break' '#.TEMP'
FilesAndDirs.RmDir tempDir,'/..' Does not work: the .NET DLL blocks this; there is no way around this at the time of writing (October 2023)
(rc msg)FilesAndDirs.RmDirByForce tempFolder
msg Assert 0=rc
Done
51 changes: 8 additions & 43 deletions APLSource/TestCases/Test_UC_051.aplf
Original file line number Diff line number Diff line change
@@ -1,50 +1,15 @@
RTest_UC_051(stopFlag batchFlag);⎕TRAP;folder;res;log;cals;success;tempDir;config;msg;rc;stop;batch;ref
RTest_UC_051(stopFlag batchFlag);⎕TRAP;tempFolder;parms;I;rc;msg
Open project, add 2 NuGet packages to non-default folder, load, call, list, close, re-open, close
The real test function (∆Test_UC_051) is executed in its own APL process
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If 1 122500 We need .NET Core and a successfully loaded .NET bridge
RT._NotApplicable 0
:EndIf

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
tempDir ⎕NCOPY1folder,'/*'

ref∆GetRefToCommTools
ref.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
stop0
(rc msg res)stop ∆UCMD'OpenProject ',tempDir,' -projectSpace=TEMP -batch -ignoreUserExec'
Assert rc=0

ref.YesOrNo_Answers1 2'LoadNuGetDependenciesAfterAdding@' 'y'
(rc msg res)stop ∆UCMD'AddNuGetDependencies clock,NODATIME ',tempDir
Assert rc=0
T.GoToTidyUp~'Clock' 'NodaTime'∆LazyMatch res

(rc msg res)stop ∆UCMD'ListNuGetDependencies ',tempDir
Assert rc=0
T.GoToTidyUp 2res

(rc msg res)∆UCMD'CloseProject ',tempDir,' -fast'
Assert rc=0
T.GoToTidyUp'Number of projects closed: 1'res

#.TEMP.(⎕EX ⎕NL-9)
(rc msg res)stop ∆UCMD'OpenProject ',tempDir,' -projectSpace=TEMP -batch -ignoreUserExec'
Assert rc=0
T.GoToTidyUp'Project successfully opened and established in "#.TEMP"'res~⎕TC
T.GoToTidyUp~('UtcNow')#.TEMP.Clock.⎕NL-2
T.GoToTidyUp~/'Julian' 'Gregorian'¨#.TEMP.NodaTime.CalendarSystem.⎕NL-2

(rc msg res)∆UCMD'CloseProject ',tempDir,' -fast'
Assert rc=0

RT._OK
tempFolder∆GetFolderInTempDir⎕SI
parms∆NuGetTestProcessParms(⎕SI)tempFolder
I⎕NEW APLProcess(,parms)
RI.ExitCode

∆TidyUp:
ref.Cleanup
res∆LINK'Break' '#.TEMP'
FilesAndDirs.RmDir tempDir,'/..' Does not work: the .NET DLL blocks this; there is no way around this at the time of writing (October 2023)
(rc msg)FilesAndDirs.RmDirByForce tempFolder
msg Assert 0=rc
Done
35 changes: 35 additions & 0 deletions APLSource/TestCases/∆Test_UC_045.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
R∆Test_UC_045(stopFlag batchFlag);⎕TRAP;res;msg;rc;folder;parms;tempDir;success;log
Exercise ]Cider.AddNuGetDependencies and ListNuGetDependencies
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆TEMP_PATH
tempDir ⎕NCOPY1folder,'/*'

parms##.Cider.CreateOpenParms''
parms.folder⎕NPARTS tempDir
parms.noPkgLoad0
parms.batch1
parms.ignoreUserExec1

##.Cider.C.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
(success log)##.Cider.OpenProject parms
T.GoToTidyUp~success
T.GoToTidyUp/'ERROR'log

{}##.Cider.AddNuGetDependencies'Clock,NodaTime'tempDir Clock is already installed

(rc msg res)∆UCMD'ListNuGetDependencies "',tempDir,'"'
T.GoToTidyUp rc0
T.GoToTidyUp 0msg
T.GoToTidyUp 2res
T.GoToTidyUp 22res

RT._OK

∆TidyUp:
##.Cider.C.Cleanup
{}∆LINK'Break' '#.TEMP'
Done
46 changes: 46 additions & 0 deletions APLSource/TestCases/∆Test_UC_050.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
R∆Test_UC_050(stopFlag batchFlag);⎕TRAP;folder;res;log;cals;success;tempDir;config;msg;rc;stop;batch;Cleanup;ref
Open project, add 2 NuGet packages to default folder, load, call, list, close, re-open, close
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆TEMP_PATH
tempDir ⎕NCOPY1folder,'/*'

ref∆GetRefToCommTools
ref.YesOrNo_Answers1 2'ChangeCurrentDir@' 'n'
stop0
(rc msg res)stop ∆UCMD'OpenProject ',tempDir,' -projectSpace=TEMP -batch -ignoreUserExec'
Assert rc=0

ref.YesOrNo_Answers1 2'LoadNuGetDependenciesAfterAdding@' 'y'
(rc msg res)stop ∆UCMD'AddNuGetDependencies Clock,NodaTime ',tempDir
Assert rc=0
T.GoToTidyUp 2+/'Clock' 'NodaTime'{0<('\b',,'\b')⎕S 0}¨res

(rc msg res)stop ∆UCMD'ListNuGetDependencies ',tempDir
Assert rc=0
T.GoToTidyUp 2res

ref.YesOrNo_Answers1 2'Do you wish to )CLEAR the workspace?' 'y'
(rc msg res)∆UCMD'CloseProject ',tempDir,' -fast'
Assert rc=0
T.GoToTidyUp~/'Number of projects closed: 1'res

#.TEMP.(⎕EX ⎕NL-9)
(rc msg res)stop ∆UCMD'OpenProject ',tempDir,' -projectSpace=TEMP -batch -ignoreUserExec'
Assert rc=0
T.GoToTidyUp'Project successfully opened and established in "#.TEMP"'res~⎕TC
T.GoToTidyUp~('UtcNow')#.TEMP.Clock.⎕NL-2
T.GoToTidyUp~/'Julian' 'Gregorian'¨#.TEMP.NodaTime.CalendarSystem.⎕NL-2

(rc msg res)∆UCMD'CloseProject ',tempDir,' -fast'
Assert rc=0

RT._OK

∆TidyUp:
ref.Cleanup
res∆LINK'Break' '#.TEMP'
Done
Loading

0 comments on commit d417e68

Please sign in to comment.