Skip to content

Commit

Permalink
[Bat] add a unit test (#70)
Browse files Browse the repository at this point in the history
* test: add a unit test to bat package to ensure the package is well built

Signed-off-by: jaudiger <jeremy.audiger@ioterop.com>

* fix: fix typo in run_bash.bri file

Signed-off-by: jaudiger <jeremy.audiger@ioterop.com>

---------

Signed-off-by: jaudiger <jeremy.audiger@ioterop.com>
  • Loading branch information
jaudiger authored Jul 17, 2024
1 parent a85d46c commit c6f1c1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions packages/bat/project.bri
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,23 @@ const source = std
.unarchive("tar", "gzip")
.peel();

export default () => {
export default function bat(): std.Recipe<std.Directory> {
return cargoBuild({
source,
runnable: "bin/bat",
});
};
}

export async function test() {
const script = std.runBash`
echo -n $(bat --version) | tee "$BRIOCHE_OUTPUT"
`.dependencies(bat());

const result = await script.toFile().read();

// Check that the result contains the expected version
const expected = `bat ${project.version}`;
std.assert(result === expected, `expected '${expected}', got '${result}'`);

return script;
}
2 changes: 1 addition & 1 deletion packages/std/extra/run_bash.bri
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { tools } from "/toolchain";
* Bash script should create the path `$BRIOCHE_OUTPUT`, which will be used
* as the output of the recipe.
*
* This funtion returns `std.Process`, which can be used for passing in
* This function returns `std.Process`, which can be used for passing in
* extra dependencies or environment variables using `.dependencies()`
* or `.env()`, respectively, along with other process options.
*
Expand Down

0 comments on commit c6f1c1d

Please sign in to comment.