-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
7aefee1
commit 175a061
Showing
6 changed files
with
104 additions
and
119 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import modpack/[loader, manifest, version] | ||
|
||
block: # manifest loader | ||
let m = Manifest() | ||
m.name = "testmodpack" | ||
m.author = "testauthor" | ||
m.version = "1.0.0" | ||
m.mcVersion = "1.16.3".Version | ||
|
||
m.mcModloaderId = "fabric-0.11.0" | ||
doAssert m.loader == Loader.Fabric | ||
|
||
m.mcModloaderId = "forge-34.1.0" | ||
doAssert m.loader == Loader.Forge | ||
|
||
let file = initManifestFile( | ||
projectId = 111, | ||
fileId = 200, | ||
initManifestMetadata( | ||
name = "test", | ||
explicit = true, | ||
pinned = false, | ||
dependencies = @[] | ||
) | ||
) | ||
|
||
block: # manifest mods | ||
var m = Manifest() | ||
m.name = "testmodpack" | ||
m.author = "testauthor" | ||
m.version = "1.0.0" | ||
m.mcVersion = "1.16.3".Version | ||
|
||
doAssert m.files.len == 0 | ||
|
||
block: # install | ||
m.installAddon(file) | ||
doAssert m.files.len == 1 | ||
doAssert m.files[0].projectId == 111 | ||
doAssert m.files[0].fileId == 200 | ||
|
||
block: # update with project & file id | ||
m.updateAddon(111, 300) | ||
doAssert m.files.len == 1 | ||
doAssert m.files[0].projectId == 111 | ||
doAssert m.files[0].fileId == 300 | ||
|
||
block: # update with file | ||
m.updateAddon(file) | ||
doAssert m.files.len == 1 | ||
doAssert m.files[0].projectId == 111 | ||
doAssert m.files[0].fileId == 300 | ||
|
||
block: # remove | ||
discard m.removeAddon(111) | ||
doAssert m.files.len == 0 |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import std/[json, tempfiles, os] | ||
import modpack/[manifest, version] | ||
|
||
block: # manifest write / read from disk | ||
let m = Manifest() | ||
m.name = "testmodpack" | ||
m.author = "testauthor" | ||
m.version = "1.0.0" | ||
m.mcVersion = "1.16.3".Version | ||
|
||
let tmpdir = createTempDir("", "") | ||
m.writeToDisk(path = tmpdir) | ||
let readM = readManifestFromDisk(path = tmpdir) | ||
doAssert m.toJson == readM.toJson |
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