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

new: Support proto v0.17. #1

Merged
merged 5 commits into from
Sep 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests.
milesj committed Sep 9, 2023
commit a8094f04afd952d307bc3c006712ceee5400674f
3 changes: 3 additions & 0 deletions tests/download_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use proto_pdk_test_utils::*;

generate_download_install_tests!("python-test", "3.10.0");
5 changes: 5 additions & 0 deletions tests/globals_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// use proto_pdk_test_utils::*;

// // Currently times out on Windows!
// #[cfg(not(windows))]
// generate_globals_test!("go-test", "golang.org/x/tools/cmd/stringer@latest", "GOBIN");
17 changes: 17 additions & 0 deletions tests/metadata_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use proto_pdk_test_utils::*;
use starbase_sandbox::create_empty_sandbox;

#[test]
fn registers_metadata() {
let sandbox = create_empty_sandbox();
let plugin = create_plugin("python-test", sandbox.path());

assert_eq!(
plugin.register_tool(ToolMetadataInput::default()),
ToolMetadataOutput {
name: "Python".into(),
plugin_version: Some(env!("CARGO_PKG_VERSION").into()),
..ToolMetadataOutput::default()
}
);
}
4 changes: 4 additions & 0 deletions tests/shims_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use proto_pdk_test_utils::*;

#[cfg(not(windows))]
generate_global_shims_test!("python-test");
13 changes: 13 additions & 0 deletions tests/snapshots/shims_test__creates_global_shims.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tests/shims_test.rs
expression: "std::fs::read_to_string(sandbox.path().join(\".proto/bin\").join(if cfg!(windows)\n {\n format!(\"{}.cmd\", \"python-test\")\n } else { \"python-test\".to_string() })).unwrap()"
---
#!/usr/bin/env bash
set -e
[ -n "$PROTO_DEBUG" ] && set -x



exec proto run python-test -- "$@"


31 changes: 31 additions & 0 deletions tests/versions_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use proto_pdk_test_utils::*;
use starbase_sandbox::create_empty_sandbox;

generate_resolve_versions_tests!("python-test", {
"2.3" => "2.3.7",
"3.10.1" => "3.10.1",
"3.10" => "3.10.13",
"3" => "3.11.5",
});

#[test]
fn loads_versions_from_git() {
let sandbox = create_empty_sandbox();
let plugin = create_plugin("python-test", sandbox.path());

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

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

#[test]
fn sets_latest_alias() {
let sandbox = create_empty_sandbox();
let plugin = create_plugin("python-test", sandbox.path());

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

assert!(output.latest.is_some());
assert!(output.aliases.contains_key("latest"));
assert_eq!(output.aliases.get("latest"), output.latest.as_ref());
}