1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-16 20:45:22 +00:00
krust/src/registry/tests.rs
Jason Hall 5e89023925
Initial commit: krust - container image build tool for Rust
krust builds container images for Rust applications without Docker:
- Builds static binaries using musl libc
- Creates minimal OCI container images
- Pushes to any OCI-compliant registry
- Outputs digest to stdout for composability

Inspired by ko.build for Go applications.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 20:46:08 -04:00

27 lines
826 B
Rust

#[cfg(test)]
mod tests {
use super::super::*;
#[test]
fn test_parse_image_reference() {
let (registry, repo, tag) =
parse_image_reference("docker.io/library/hello-world:latest").unwrap();
assert_eq!(registry, "docker.io");
assert_eq!(repo, "library/hello-world");
assert_eq!(tag, "latest");
}
#[test]
fn test_parse_image_reference_no_tag() {
let (_, _, tag) = parse_image_reference("docker.io/library/hello-world").unwrap();
assert_eq!(tag, "latest");
}
#[test]
fn test_parse_image_reference_with_port() {
let (registry, repo, tag) = parse_image_reference("localhost:5000/myapp:v1.0").unwrap();
assert_eq!(registry, "localhost:5000");
assert_eq!(repo, "myapp");
assert_eq!(tag, "v1.0");
}
}