type Tests {
"""
Container tests.
"""
pub container: ContainerTests! {
ContainerTests
}
"""
Tool installation tests.
"""
pub tool: ToolTests! {
ToolTests
}
"""
Cargo command tests.
"""
pub cargo: CargoTests! {
CargoTests
}
}
type ContainerTests {
"""
Verifies that the default Rust container exposes Cargo.
"""
pub cargoVersion: Container! @check {
rust(useCargoChef: false, noCache: true)
.container
.withExec(["cargo", "--version"])
}
}
type ToolTests {
let test(workspace: Workspace!, tool: String!, binaryName: String! = tool): Container! @check {
let container = rust(workspace, tools: [tool]).container
assert {
container.exists("/usr/local/cargo/bin/" + binaryName, expectedType: ExistsType.REGULAR_TYPE)
}
container
}
"""
Verifies that cargo-audit is installed succesfully.
"""
pub audit(workspace: Workspace!): Container! @check {
test(workspace, "cargo-audit")
}
"""
Verifies that dioxus-cli is installed succesfully.
"""
pub dioxusCli(workspace: Workspace!): Container! @check {
test(workspace, "dioxus-cli", "dx")
}
}
type CargoTests {
let init(workspace: Workspace!): Rust! {
rust(
workspace: workspace,
workspacePath: "fixtures/basic",
useCargoChef: false,
noCache: true,
)
}
"""
Various tests for building Rust projects.
"""
pub build: CargoBuildTests! {
CargoBuildTests
}
"""
Verifies that the module
"""
pub test(workspace: Workspace!): String! @check {
init(workspace).test
}
"""
Verifies that the module
"""
pub audit(workspace: Workspace!): String! @check {
init(workspace).audit
}
"""
Verifies that the module checks Rust source formatting.
"""
pub fmt(workspace: Workspace!): String! @check {
init(workspace).fmt
}
}
type CargoBuildTests {
"""
Verifies that the module builds a local Rust project.
"""
pub local(workspace: Workspace!): Directory! @check {
rust(
workspacePath: "fixtures/basic",
useCargoChef: false,
noCache: true,
).build(workspace)
}
"""
Verifies that the module builds a real Rust project.
"""
pub remote(workspace: Workspace!): Directory! @check {
let source = Dagger.git("https://github.com/sagikazarmark/restate-opendal.git").head.tree
Dagger.rust(useCargoChef: false).build(source: source)
}
}