-
Notifications
You must be signed in to change notification settings - Fork 1
/
Test-Document.ps1
50 lines (39 loc) · 1.19 KB
/
Test-Document.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Runs some tests on the given PDF document.
.DESCRIPTION
This script is responsible to test all LaTeX files (usually files ending with .tex).
Currently, only the existence of the document is tested.
The script is used in the contineous integration stage (see workflows/ci.yml) to ensure
integrity of the generated PDF document.
.INPUTS
None. You cannot pipe objects into this script.
.OUTPUTS
None. The output is undefined.
.EXAMPLE
./Test-Document -DocumentPath "/opt/source/somePdf.pdf"
.LINK
https://github.com/yax-lakam-tuun/maya-decipherment
#>
[CmdletBinding()]
param (
[string]
# The file name of the PDF document.
[Parameter(Mandatory=$true, HelpMessage="Enter PDF document.")]
$DocumentPath
)
function Test-Existance {
param (
[Parameter(Mandatory=$true)]
[string] $DocumentPath
)
if (Test-Path -Path $DocumentPath -PathType Leaf) {
Write-Output "Document $DocumentPath exists - OK"
} else {
Write-Error "Document $DocumentPath not found - FAILED"
Exit 1
}
}
Test-Existance -DocumentPath $DocumentPath
Write-Output "All tests passed."