Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
fix: Fix \d not working in version-pattern (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phault authored Feb 21, 2024
1 parent 5fa7476 commit a383524
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ crate-type = ['cdylib']

[dependencies]
extism-pdk = "1.0.0"
proto_pdk = { version = "0.15.1" } #, path = "../../proto/crates/pdk" }
regex = { version = "1.10.3", default-features = false, features = ["std"] }
proto_pdk = { version = "0.15.1" } #, path = "../../proto/crates/pdk" }
regex = { version = "1.10.3", default-features = false, features = [
"std",
"unicode-perl",
] }
serde = "1.0.195"
serde_json = "1.0.111"

Expand Down
20 changes: 20 additions & 0 deletions tests/__fixtures__/schemas/version-pattern.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bin = "moon-test"
name = "moon-test"
type = "cli"

[platform.linux]
download-file = "moon-{arch}-unknown-linux-{libc}"

[platform.macos]
download-file = "moon-{arch}-apple-darwin"

[platform.windows]
download-file = "moon-{arch}-pc-windows-msvc.exe"

[install]
download-url = "https://github.com/moonrepo/moon/releases/download/v{version}/{download_file}"
unpack = false

[resolve]
git-url = "https://github.com/moonrepo/moon"
version-pattern = "^v((?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+))"
15 changes: 14 additions & 1 deletion tests/versions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ generate_resolve_versions_tests!(
"1.0.3" => "1.0.3",
"1.4" => "1.4.0",
"1.5" => "1.5.1",
"1" => "1.19.3",
},
Some(locate_fixture("schemas").join("base.toml"))
);
Expand Down Expand Up @@ -41,3 +40,17 @@ fn sets_latest_alias() {
assert!(output.aliases.contains_key("latest"));
assert_eq!(output.aliases.get("latest"), output.latest.as_ref());
}

#[test]
fn version_pattern_supports_common_classes() {
let sandbox = create_empty_sandbox();
let plugin = create_schema_plugin(
"schema-test",
sandbox.path(),
locate_fixture("schemas").join("version-pattern.toml"),
);

let output = plugin.load_versions(LoadVersionsInput::default());

assert!(!output.versions.is_empty());
}

0 comments on commit a383524

Please sign in to comment.