Open evshvarov opened 1 year ago
From a resource naming perspective, there's a lot of meaning (and dependencies in code) where a name starting with "/" indicates something on the filesystem and a name that doesn't indicates something in the database (e.g., a class/package/routine/%Studio.AbstractDocument). I believe this distinction is important and worth maintaining. SourcesRoot is a different context so the inconsistency does not bother me too much.
@isc-tleavitt - I think this needs more consistency. Technically unittests and code resources are the same classes and packages. But the way we ask developers to describe unittests resources is just different. E.g. see the following module XML:
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Document name="csvgen.ZPM">
<Module>
<Name>csvgen</Name>
<Version>1.5.1</Version>
<Description>Module to generate import and export csv data using InterSystems ObjectScript</Description>
<Packaging>module</Packaging>
<SourcesRoot>src</SourcesRoot>
<Resource Name="community.PKG"/>
<UnitTest Name="/tests" Package="community.csvgen.UnitTests" Phase="test"/>
</Module>
</Document>
</Export>
For the source code we have SourcesRoot path where we can expect resources:
and then Resource tag with Name element for the package:
For the unit tests the path starts with "/" which is different to SourceRoot notation where leading "/" is not needed.
I'd suggest we introduce
<UnitTestsRoot>tests</UnitTestsRoot>
And
<TestResource> Name="community.csvgen.UnitTests" </TestResource>
So the final module.xml will be in this case:
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Document name="csvgen.ZPM">
<Module>
<Name>csvgen</Name>
<Version>1.5.1</Version>
<Description>Module to generate import and export csv data using InterSystems ObjectScript</Description>
<Packaging>module</Packaging>
<SourcesRoot>src</SourcesRoot>
<Resource Name="community.PKG"/>
<UnitTestsRoot>tests</UnitTestsRoot>
<TestResource Name="community.csvgen.UnitTests" Phase="test"/>
</Module>
</Document>
</Export>
@evshvarov that's fair - reopening.
Currently we name source root for the Objectscript source code without "/" E.g.
But the directory for unit-tests should be indicated with "/", .e.g.
Could we support both "/tests" and "tests" notation for folder naming for unittests?