mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
65 lines
1.6 KiB
Rust
65 lines
1.6 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());
|
|
}
|
|
|
|
#[test]
|
|
fn run_multi_module() {
|
|
let out = run_roc(&[
|
|
"run",
|
|
example_file("multi-module", "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());
|
|
}
|
|
}
|