-
Notifications
You must be signed in to change notification settings - Fork 8
No folders fix #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No folders fix #138
Changes from 4 commits
f1394c2
24cca22
babc7f2
1a83979
dc6d442
ee21bf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Import SourceControl.Git | ||
|
||
Include SourceControl.Git | ||
|
||
Class UnitTest.SourceControl.Git.NameToInternalNameTest Extends %UnitTest.TestCase | ||
{ | ||
|
||
Property Mappings [ MultiDimensional ]; | ||
|
||
Method TestRegularClassNames() | ||
{ | ||
// Regular class that exists | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\SourceControl\Git\Utils.cls"),"SourceControl.Git.Utils.CLS") | ||
// Regular class that doesn't exist and we ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\SourceControl\Git\DoesNotExist.cls"),"") | ||
// Regular class that doesn't exist and we don't ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\SourceControl\Git\DoesNotExist.cls", 1, 0),"SourceControl.Git.DoesNotExist.CLS") | ||
} | ||
|
||
Method TestPercentClassNames() | ||
{ | ||
// % class that exists but we ignore % classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\%Studio\Extension\Base.cls"),"") | ||
// % class that exists and we don't ignore % classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\%Studio\Extension\Base.cls", 0),"%Studio.Extension.Base.CLS") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In all of these cases, we shouldn't have % in the folder name. (I believe this is illegal in Windows which is why we generally don't do it.) But it should still work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. I forgot about that. I'll change the tests. |
||
// % class that doesn't exist and we ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\%Studio\Extension\DoesNotExist.cls", 0),"") | ||
// % class that doesn't exist and we don't ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("cls\%Studio\Extension\DoesNotExist.cls", 0, 0),"%Studio.Extension.DoesNotExist.CLS") | ||
} | ||
|
||
Method TestAbstractDocumentClassNames() | ||
{ | ||
// %Studio.AbstractDocument type that exists | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("nspace\hl7\TestSchema.hl7"),"TestSchema.HL7") | ||
// %Studio.AbstractDocument type that exists with '.' in the name | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("nspace\hl7\2.1.1.1.1.hl7"),"2.1.1.1.1.HL7") | ||
// %Studio.AbstractDocument type that does not exist and we ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("nspace\hl7\DoesNotExist.hl7"),"") | ||
// %Studio.AbstractDocument type that doesn't exist and we don't ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("nspace\hl7\DoesNotExist.hl7", 1, 0),"DoesNotExist.HL7") | ||
} | ||
|
||
Method TestStaticFileNames() | ||
{ | ||
// Static file that shouldn't be on the server | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("git-webui\src\js\git-webui.js"),"") | ||
// Static file that shouldn't be on the server but we don't ignore non-existent classes | ||
do $$$AssertEquals(##class(Utils).NameToInternalName("git-webui\src\js\git-webui.js", 1, 0),"") | ||
} | ||
|
||
Method OnBeforeAllTests() As %Status | ||
{ | ||
merge ..Mappings = @##class(SourceControl.Git.Utils).MappingsNode() | ||
kill @##class(SourceControl.Git.Utils).MappingsNode() | ||
set $$$SourceMapping("CLS", "*") = "cls/" | ||
set $$$SourceMapping("HL7", "*", "NoFolders") = "nspace/hl7/" | ||
quit $$$OK | ||
} | ||
|
||
Method %OnClose() As %Status | ||
{ | ||
merge @##class(SourceControl.Git.Utils).MappingsNode() = ..Mappings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should kill the mappings node as well (first). As it stands it'll leave the nspace/hl7/ in place. |
||
quit $$$OK | ||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If $data(ext)=0 then killing it is a no-op.