mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
// #[macro_use]
|
|
extern crate pretty_assertions;
|
|
|
|
extern crate bumpalo;
|
|
extern crate inlinable_string;
|
|
extern crate roc_collections;
|
|
extern crate roc_load;
|
|
extern crate roc_module;
|
|
|
|
mod helpers;
|
|
|
|
#[cfg(test)]
|
|
mod cli_run {
|
|
use crate::helpers::{example_file, run_roc};
|
|
|
|
#[test]
|
|
fn run_hello_world() {
|
|
let out = run_roc(&[
|
|
"run",
|
|
example_file("hello-world", "Hello.roc").to_str().unwrap(),
|
|
]);
|
|
|
|
if !out.stderr.is_empty() {
|
|
panic!(out.stderr);
|
|
}
|
|
assert!(&out.stdout.ends_with("Hello, World!!!!!!!!!!!!!\n"));
|
|
assert!(out.status.success());
|
|
}
|
|
|
|
#[test]
|
|
fn run_quicksort() {
|
|
let out = run_roc(&[
|
|
"run",
|
|
example_file("quicksort", "Quicksort.roc").to_str().unwrap(),
|
|
"--optimize",
|
|
]);
|
|
|
|
if !out.stderr.is_empty() {
|
|
panic!(out.stderr);
|
|
}
|
|
assert!(&out
|
|
.stdout
|
|
.ends_with("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"));
|
|
assert!(out.status.success());
|
|
}
|
|
}
|