-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
243 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
let(((Path VrtImport['Path]) | ||
(Test VrtImport['Test]) | ||
(Virtue VrtImport['Virtue]) | ||
) | ||
|
||
; Fixtures | ||
; -------- | ||
|
||
procedure(directory_path() | ||
Path->Concat("/absolute" "path" "to" "a" "directory") | ||
) | ||
|
||
procedure(file_path() | ||
Path->Concat("/absolute" "path" "to" "a" "file.txt") | ||
) | ||
|
||
Test->Fixtures['directory_path] = directory_path | ||
Test->Fixtures['file_path] = file_path | ||
|
||
; Tests | ||
; ----- | ||
|
||
procedure(Test_PathConcat() | ||
assert(Path->Concat("/absolute" "path" "to" "a" "directory") == | ||
"/absolute/path/to/a/directory") | ||
assert(Path->Concat("" "absolute" "path" "to" "a" "directory") == | ||
"/absolute/path/to/a/directory") | ||
assert(Path->Concat("/absolute" "path" "to" "a" "file.txt") == | ||
"/absolute/path/to/a/file.txt") | ||
) | ||
|
||
procedure(Test_PathCat() | ||
assert(Path->Cat("/absolute" "path" "to" "a" "directory") == | ||
"/absolute/path/to/a/directory") | ||
assert(Path->Cat("" "absolute" "path" "to" "a" "directory") == | ||
"/absolute/path/to/a/directory") | ||
assert(Path->Cat("/absolute" "path" "to" "a" "file.txt") == | ||
"/absolute/path/to/a/file.txt") | ||
) | ||
|
||
procedure(Test_FileName(file_path directory_path) | ||
assert(Path->FileName(file_path) == "file.txt") | ||
assert(Path->FileName(directory_path) == "directory") | ||
) | ||
|
||
procedure(Test_Folder(file_path directory_path) | ||
assert(Path->FileName(file_path) == "/absolute/path/to/a") | ||
assert(Path->FileName(directory_path) == "/absolute/path/to/a") | ||
) | ||
|
||
procedure(Test_RemoveExtension(file_path) | ||
assert(Path->RemoveExtension(file_path) == "/absolute/path/to/a/file") | ||
assert(Path->RemoveExtension(directory_path) == "/absolute/path/to/a/directory") | ||
assert(Path->RemoveExtension("file.ext") == "file") | ||
) | ||
|
||
procedure(Test_UpdateExtension(file_path) | ||
assert(Path->UpdateExtension(file_path "new") == "/absolute/path/to/a/file.new") | ||
assert(Path->UpdateExtension(directory_path "new") == "/absolute/path/to/a/directory.new") | ||
assert(Path->UpdateExtension("file.ext" "new") == "file.new") | ||
) | ||
|
||
procedure(Test_FileExtension(file_path) | ||
assert(Path->FileExtension(file_path) == "txt") | ||
assert(Path->FileExtension(directory_path) == "") | ||
assert(Path->FileExtension("file.ext") == "ext") | ||
assert(Path->FileExtension("file.myext") == "myext") | ||
) | ||
|
||
procedure(Test_lint_Path(lint_settings) | ||
assert(sklint( | ||
?file Path->Cat(lint_settings->testsDir | ||
"data_types/Path.ils") | ||
?outputFile Path->Cat(lint_settings->outputDir | ||
"lint_report_Path.txt") | ||
?prefixes lint_settings->prefixes | ||
)) | ||
) | ||
|
||
procedure(Test_lint_Test_Path(lint_settings) | ||
assert(sklint( | ||
?file Path->Cat(lint_settings->testsDir | ||
"data_types/test_Path.ils") | ||
?outputFile Path->Cat(lint_settings->outputDir | ||
"lint_report_test_Path.txt") | ||
?prefixes lint_settings->prefixes | ||
)) | ||
) | ||
|
||
Test->RunFile(list(nil | ||
'Test_PathConcat Test_PathConcat | ||
'Test_PathCat Test_PathCat | ||
'Test_FileName Test_FileName | ||
'Test_Folder Test_Folder | ||
'Test_RemoveExtension Test_RemoveExtension | ||
'Test_UpdateExtension Test_UpdateExtension | ||
'Test_FileExtension Test_FileExtension | ||
'Test_lint_Path Test_lint_Path | ||
'Test_lint_Test_Path Test_lint_Test_Path | ||
) | ||
?filepath Virtue->GetCurrentFilePath() | ||
) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,50 @@ | ||
let((dir_path | ||
(Test VrtImport['Test]) | ||
(Path VrtImport['Path]) | ||
(Virtue VrtImport['Virtue]) | ||
(Str VrtImport['Str]) | ||
) | ||
|
||
dir_path = Virtue->GetCurrentFileDirectory() | ||
Test->RunDirectory(dir_path) | ||
|
||
dir_path = Virtue->GetCurrentFileDirectory() | ||
dir_path = Path->Cat(dir_path) | ||
|
||
; Shared Test Fixtures | ||
; -------------------- | ||
|
||
procedure(lint_settings() | ||
"Test" | ||
let(((outputDir simplifyFilename(Path->Cat(dir_path "../test"))) | ||
(prefixes '(Vrt VrtImport)) | ||
) | ||
|
||
|
||
createDirHier(Path->Cat(outputDir "data_types")) | ||
|
||
procedure(RunLint(relativeFilePath) | ||
"Run lint on a file relative to the tests directory" | ||
; funcall is necessary since sklint is an nlambda function and | ||
; selectively evaluates the args in the function rather than | ||
; within the lexical env before the function call. | ||
funcall(sklint | ||
?file Path->Cat(dir_path relativeFilePath) | ||
?outputFile Path->Cat(outputDir strcat( | ||
"lint_report_" | ||
Path->RemoveExtension(Path->FileName(relativeFilePath)) | ||
".txt")) | ||
?prefixes prefixes | ||
) | ||
) | ||
|
||
list(nil | ||
'RunLint RunLint | ||
'outputDir outputDir | ||
'prefixes prefixes | ||
'testsDir dir_path | ||
) | ||
)) | ||
|
||
Test->Fixtures['lint_settings] = lint_settings | ||
|
||
Test->RunDirectory(Path->Cat(dir_path "data_types")) | ||
;Test->RunDirectory(dir_path) | ||
) |
Oops, something went wrong.