Skip to content

Commit

Permalink
.NET-Handling improved (test cases)
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Jun 27, 2024
1 parent 2d3de10 commit f783f13
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 20 deletions.
8 changes: 4 additions & 4 deletions APLSource/Admin/InstallCider.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
selectFlag1
:EndIf
:Case 'Lin'
:If ~⎕NEXISTS installFolderif1'/home/',⎕AN,'/dyalog.files/SessionExtensions/CiderTatin/Cider'
:AndIf ~⎕NEXISTS installFolderif2'/home/',⎕AN,'/','dyalog.',('.'~{/2>+\='.'}2aplVersion),'U',(¯21aplVersion),'.files/SessionExtensions/CiderTatin/Cider'
:If ~⎕NEXISTS installFolderif1(2 ⎕NQ'.' 'GetEnvironment' 'HOME'),'/dyalog.files/SessionExtensions/CiderTatin/Cider'
:AndIf ~⎕NEXISTS installFolderif2(2 ⎕NQ'.' 'GetEnvironment' 'HOME'),'/','dyalog.',('.'~{/2>+\='.'}2aplVersion),'U',(¯21aplVersion),'.files/SessionExtensions/CiderTatin/Cider'
selectFlag1
:EndIf
:Case 'Mac'
:If ~⎕NEXISTS installFolderif1'/Users/',⎕AN,'/dyalog.files/SessionExtensions/CiderTatin/Cider'
:AndIf ~⎕NEXISTS installFolderif2'/Users/',⎕AN,'/','dyalog.',('.'~{/2>+\='.'}2aplVersion),'U',(¯21aplVersion),'.files/SessionExtensions/CiderTatin/Cider'
:If ~⎕NEXISTS installFolderif1(2 ⎕NQ'.' 'GetEnvironment' 'HOME'),'/dyalog.files/SessionExtensions/CiderTatin/Cider'
:AndIf ~⎕NEXISTS installFolderif2(2 ⎕NQ'.' 'GetEnvironment' 'HOME'),'/','dyalog.',('.'~{/2>+\='.'}2aplVersion),'U',(¯21aplVersion),'.files/SessionExtensions/CiderTatin/Cider'
selectFlag1
:EndIf
:Else
Expand Down
7 changes: 3 additions & 4 deletions APLSource/Cider/GetUserHomPath.aplf
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
rGetUserHomPath;os
Returns the user's HOME path on the current operating system, like
/home/<⎕an> on Linux
Returns the user's HOME path on the current operating system
:Select osAPLTreeUtils2.GetOperatingSystem
:Case 'Win'
r¯11 ⎕NPARTS ¯11 ⎕NPARTS 240700
:Case 'Lin'
r'/home/',⎕AN
r2 ⎕NQ'.' 'GetEnvironment' 'HOME'
:Case 'Mac'
r'/Users/',⎕AN
r2 ⎕NQ'.' 'GetEnvironment' 'HOME'
:Else
('<',os,'> is not a supported operating system')⎕SIGNAL 11
:EndSelect
4 changes: 4 additions & 0 deletions APLSource/Cider/History.apla
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(
'* 0.41.1 ⋄ 2024-06-27'
' * On Linux and Mac-OS, the folder /home/<⎕AN> is no longer hard coded but established with '
' 2 ⎕NQ ''.'' ''GetEnvironment'' ''HOME'''
' * NuGet-related test cases optimized '
'* 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'
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+671'
r'0.41.1+671'
3 changes: 3 additions & 0 deletions APLSource/TestCases/Initial_NuGet.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
info'Could not load the .NET bridge interface.'
:EndIf
:EndIf
:Else
info'.NET is not available, therefore the NuGet tests cannot be executed.'
:EndIf
:If 0=netcore
:AndIf ~ps.batchFlag
:AndIf 0<info
CommTools.Pause info,(⎕UCS 13),'Therefore the NuGet tests cannot be executed.'
r0
:EndIf
Done
17 changes: 11 additions & 6 deletions APLSource/TestCases/IsDotNetAvailable.aplf
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
rIsDotNetAvailable
rIsDotNetAvailable;res;parms;I
Checks whether .NET (rather than .NET framework) is available at all.
:Trap 11 On Linux and Mac-OS, a DOMAIN ERROR will occur if .NET is not installed
:If 0=r/'.NETCore'⎕CMD'dotnet --list-runtimes'
r/'\dotnet\'⎕CMD'dotnet --list-sdks'
We cannot do this in the current APL session on Windows because that might use .NET Framework but
.NET might still be available, so we start a process which will exit with 125 for "yes", 126 for "no"
and "123" for "error".
:If 'Win'APLTreeUtils2.GetOperatingSystem
:If 0=r1 1222500 The current APL ight already be configured for .NET
parms∆NuGetTestProcessParms
I⎕NEW APLProcess(,parms)
r125=I.ExitCode
:EndIf
:Else
r0
:Endtrap
r1 1222500
:EndIf
8 changes: 7 additions & 1 deletion APLSource/TestCases/Test_UC_045.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If ~IsDotNetAvailable
RT._NotApplicable 0
:EndIf

tempFolder∆GetFolderInTempDir⎕SI
parms∆NuGetTestProcessParms(⎕SI)tempFolder
I⎕NEW APLProcess(,parms)
RI.ExitCode
:If 0=I.ExitCode
RT._OK
:EndIf

∆TidyUp:
(rc msg)FilesAndDirs.RmDirByForce tempFolder
Expand Down
4 changes: 4 additions & 0 deletions APLSource/TestCases/Test_UC_046.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If ~IsDotNetAvailable
RT._NotApplicable 0
:EndIf

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
Expand Down
4 changes: 4 additions & 0 deletions APLSource/TestCases/Test_UC_047.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If ~IsDotNetAvailable
RT._NotApplicable 0
:EndIf

#.⎕SHADOW'TEMP' 'TEMP'#.⎕NS''
folder∆GetTestPath⎕SI
tempDir∆GetFolderInTempDir⎕SI
Expand Down
4 changes: 4 additions & 0 deletions APLSource/TestCases/Test_UC_050.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If ~IsDotNetAvailable
RT._NotApplicable 0
:EndIf

tempFolder∆GetFolderInTempDir⎕SI
parms∆NuGetTestProcessParms(⎕SI)tempFolder
I⎕NEW APLProcess(,parms)
Expand Down
4 changes: 4 additions & 0 deletions APLSource/TestCases/Test_UC_051.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

:If ~IsDotNetAvailable
RT._NotApplicable 0
:EndIf

tempFolder∆GetFolderInTempDir⎕SI
parms∆NuGetTestProcessParms(⎕SI)tempFolder
I⎕NEW APLProcess(,parms)
Expand Down
12 changes: 9 additions & 3 deletions APLSource/TestCases/∆NuGetTestProcessParms.aplf
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
parms∆NuGetTestProcessParms(name folder)
parmsAPLProcess.CreateParms
parms.Exe12 ⎕NQ #'GetCommandLineArgs' 'DYALOG'
parms.OutputFilename(7390),'/',name,'.txt'
parms.CommandLineArgs,'path=''',folder,''''
parms.CommandLineArgs,' fns=∆',name
:If 0<name
parms.OutputFilename(7390),'/',name,'.txt'
:EndIf
:If 0<folder
parms.CommandLineArgs,'path=''',folder,''''
:EndIf
:If 0<name
parms.CommandLineArgs,' fns=∆',name
:EndIf
:If 0<T.⎕NC'codeCoverage'
parms.CommandLineArgs,' codeCoverageFile=''',(T.codeCoverage.filename~''''),''''
:EndIf
Expand Down
Binary file modified Tests/ExecTestCase.dws
Binary file not shown.
2 changes: 1 addition & 1 deletion apl-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
tags: "project-management",
tatin_version: "0.103.0",
userCommandScript: "APLSource/Cider_UC.dyalog",
version: "0.41.0+747",
version: "0.41.1+749",
}

0 comments on commit f783f13

Please sign in to comment.