-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #710 from intersystems/v0.10.x-update-module-version
Add a `module-version` command that updates the version of a module
Showing
6 changed files
with
338 additions
and
1 deletion.
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
93 changes: 93 additions & 0 deletions
93
tests/integration_tests/Test/PM/Integration/ModuleVersion.cls
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,93 @@ | ||
Class Test.PM.Integration.ModuleVersion Extends Test.PM.Integration.Base | ||
{ | ||
|
||
Parameter OriginalVersion = "0.0.2-snapshot+build"; | ||
|
||
XData AllCases [ MimeType = application/json ] | ||
{ | ||
[ | ||
{ | ||
"args": "major -prerelease alpha -force", | ||
"expected": "1.0.0-alpha" | ||
}, | ||
{ | ||
"args": "minor", | ||
"expected": "0.1.0" | ||
}, | ||
{ | ||
"args": "patch", | ||
"expected": "0.0.3" | ||
}, | ||
{ | ||
"args": "-prerelease alpha -build mybuild -force", | ||
"expected": "0.0.2-alpha+mybuild" | ||
}, | ||
{ | ||
"args": "3.4.5-abc+xyz", | ||
"expected": "" | ||
}, | ||
{ | ||
"args": "3.4.5-abc+xyz -force", | ||
"expected": "3.4.5-abc+xyz" | ||
}, | ||
{ | ||
"args": "invalid string", | ||
"expected": "" | ||
}, | ||
{ | ||
"args": "0.0.1", | ||
"expected": "" | ||
}, | ||
{ | ||
"args": "0.0.1 -force", | ||
"expected": "0.0.1" | ||
}, | ||
{ | ||
"args": "0.0.2", | ||
"expected": "0.0.2" | ||
} | ||
] | ||
} | ||
|
||
Method TestModuleVersion() | ||
{ | ||
Set xdataID="Test.PM.Integration.ModuleVersion||AllCases" | ||
Set compiledXdata=##class(%Dictionary.CompiledXData).%OpenId(xdataID) | ||
Set stream=compiledXdata.Data | ||
Do $$$AssertTrue($IsObject(stream)) | ||
|
||
Set allTestCases = [].%FromJSON(stream) | ||
Set iter = allTestCases.%GetIterator() | ||
While iter.%GetNext(.key, .case) { | ||
Do $$$LogMessage("Running test case: "_case.%ToJSON()) | ||
|
||
Set args = case.args | ||
Set expected = case.expected | ||
|
||
Set modDir = ..GetModuleDir("module-version") | ||
Set sc = ##class(%IPM.Main).Shell("load " _ modDir) | ||
Do $$$AssertStatusOK(sc, "Loaded module successfully") | ||
|
||
Set sc = ##class(%IPM.Main).Shell("modver mv " _ args) | ||
If expected = "" { | ||
Do $$$AssertStatusNotOK(sc, "Module-version failed as expected") | ||
Continue | ||
} | ||
Do $$$AssertStatusOK(sc, "Module-version executed successfully") | ||
|
||
Kill mod | ||
Set mod = ##class(%IPM.Storage.Module).NameOpen("mv") | ||
Do mod.%Reload() | ||
Do $$$AssertEquals(mod.VersionString, expected) | ||
Do $$$AssertEquals(mod.Version.ToString(), expected) | ||
|
||
Kill stream | ||
Set stream = ##class(%IPM.StudioDocument.ModuleStream).NameOpen("mv") | ||
Do stream.%Reload() | ||
Set content = stream.Contents.Read() | ||
Do $$$AssertTrue(content [ ("<Version>"_expected_"</Version>")) | ||
Do $$$AssertNotTrue(content [ ("<Version>"_..#OriginalVersion_"</Version>")) | ||
} | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
tests/integration_tests/Test/PM/Integration/_data/module-version/module.xml
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<Document name="mv.ZPM"> | ||
<Module> | ||
<Name>mv</Name> | ||
<Version>0.0.2-snapshot+build</Version> | ||
<Packaging>module</Packaging> | ||
<SystemRequirements/> | ||
</Module> | ||
</Document> | ||
</Export> |