Rename the language from Dino to Rex
Files use .rex, the command is rex, and the crate, runtime prefixes, docs, editor files and examples all use the new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f44f09b6a
commit
7cf9727bcd
94 files changed
+858
-858
No files matched your search
+17
-17
@@ -1,9 +1,9 @@
|
||||
//! End-to-end tests: compile Dino programs to C, build them with the system C
|
||||
//! End-to-end tests: compile Rex programs to C, build them with the system C
|
||||
//! compiler, run them, and compare the output.
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
use dino::driver;
|
||||
use rex::driver;
|
||||
|
||||
struct Output {
|
||||
stdout: String,
|
||||
@@ -12,7 +12,7 @@ struct Output {
|
||||
}
|
||||
|
||||
fn run_source(src: &str) -> Output {
|
||||
let c = driver::compile_to_c(src).unwrap_or_else(|d| panic!("{}", d.render("test.dino", src)));
|
||||
let c = driver::compile_to_c(src).unwrap_or_else(|d| panic!("{}", d.render("test.rex", src)));
|
||||
run_c(&c, src)
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ fn golden_examples() {
|
||||
let mut n = 0;
|
||||
for entry in std::fs::read_dir(dir).unwrap() {
|
||||
let path = entry.unwrap().path();
|
||||
if path.extension().map_or(false, |e| e == "dino") {
|
||||
if path.extension().map_or(false, |e| e == "rex") {
|
||||
let src = std::fs::read_to_string(&path).unwrap();
|
||||
let want = std::fs::read_to_string(path.with_extension("out"))
|
||||
.unwrap_or_else(|_| panic!("missing .out file for {}", path.display()));
|
||||
@@ -285,7 +285,7 @@ fn generated_c_is_const_correct() {
|
||||
// wrong, the C compiler would complain about discarding `const`.
|
||||
let dir = concat!(env!("CARGO_MANIFEST_DIR"), "/examples/basics");
|
||||
for name in ["structs", "value_semantics", "lists", "list_values", "sieve", "enums", "enum_data", "errors", "optionals", "sized", "own_strings", "own_structs", "own_flows"] {
|
||||
let src = std::fs::read_to_string(format!("{dir}/{name}.dino")).unwrap();
|
||||
let src = std::fs::read_to_string(format!("{dir}/{name}.rex")).unwrap();
|
||||
let c = driver::compile_to_c(&src).unwrap();
|
||||
let exe = driver::temp_exe();
|
||||
driver::build_exe_with(
|
||||
@@ -1125,7 +1125,7 @@ fn optional_as_struct_return_through_match() {
|
||||
fn generated_c_for_errors_is_clean() {
|
||||
let dir = concat!(env!("CARGO_MANIFEST_DIR"), "/examples/basics");
|
||||
for name in ["errors", "optionals", "sized", "own_strings", "own_structs", "own_flows"] {
|
||||
let src = std::fs::read_to_string(format!("{dir}/{name}.dino")).unwrap();
|
||||
let src = std::fs::read_to_string(format!("{dir}/{name}.rex")).unwrap();
|
||||
let c = driver::compile_to_c(&src).unwrap();
|
||||
let exe = driver::temp_exe();
|
||||
driver::build_exe_with(&c, &exe, &["-std=c11", "-Wall", "-Werror=incompatible-pointer-types"])
|
||||
@@ -1314,8 +1314,8 @@ fn error_float_literal_for_integer_type() {
|
||||
// ---------- modules: `import utils` ----------
|
||||
|
||||
fn project_c(main: &str, modules: &[(&str, &str)]) -> Result<String, String> {
|
||||
driver::compile_project("main.dino", main, |key| {
|
||||
modules.iter().find(|(k, _)| *k == key).map(|(k, src)| (format!("{k}.dino"), src.to_string()))
|
||||
driver::compile_project("main.rex", main, |key| {
|
||||
modules.iter().find(|(k, _)| *k == key).map(|(k, src)| (format!("{k}.rex"), src.to_string()))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1398,7 +1398,7 @@ fn project_err(main: &str, modules: &[(&str, &str)]) -> String {
|
||||
fn error_private_function() {
|
||||
let e = project_err("import utils\nfunc main() { print(utils.helper()) }", &[("utils", UTILS)]);
|
||||
assert!(e.contains("`helper` is private to `utils`"), "{e}");
|
||||
assert!(e.contains("main.dino:2"), "{e}");
|
||||
assert!(e.contains("main.rex:2"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1420,20 +1420,20 @@ fn error_private_type() {
|
||||
#[test]
|
||||
fn error_in_module_names_that_file() {
|
||||
let e = project_err("import bad\nfunc main() { print(bad.f()) }", &[("bad", "pub func f(): int { return \"x\" }")]);
|
||||
assert!(e.contains("bad.dino:1"), "{e}");
|
||||
assert!(e.contains("bad.rex:1"), "{e}");
|
||||
assert!(e.contains("expected `int`"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_syntax_error_in_module() {
|
||||
let e = project_err("import bad\nfunc main() {}", &[("bad", "func f( {")]);
|
||||
assert!(e.contains("bad.dino"), "{e}");
|
||||
assert!(e.contains("bad.rex"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_missing_module() {
|
||||
let e = project_err("import nope\nfunc main() {}", &[]);
|
||||
assert!(e.contains("cannot find module `nope`") && e.contains("nope.dino"), "{e}");
|
||||
assert!(e.contains("cannot find module `nope`") && e.contains("nope.rex"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1452,7 +1452,7 @@ fn error_unknown_name_in_module() {
|
||||
fn error_module_does_not_see_main_or_other_imports() {
|
||||
// `b` imports nothing, so it can't use `os`
|
||||
let e = project_err("import b\nfunc main() { print(b.f()) }", &[("b", "pub func f(): int { return os.exists(\"x\") }")]);
|
||||
assert!(e.contains("b.dino"), "{e}");
|
||||
assert!(e.contains("b.rex"), "{e}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1468,7 +1468,7 @@ fn error_private_field() {
|
||||
// ---------- move on last use ----------
|
||||
|
||||
fn c_of(src: &str) -> String {
|
||||
driver::compile_to_c(src).unwrap_or_else(|d| panic!("{}", d.render("test.dino", src)))
|
||||
driver::compile_to_c(src).unwrap_or_else(|d| panic!("{}", d.render("test.rex", src)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2154,7 +2154,7 @@ fn string_slice_out_of_range_panics() {
|
||||
#[test]
|
||||
fn calc_example_session() {
|
||||
let dir = concat!(env!("CARGO_MANIFEST_DIR"), "/examples/calc");
|
||||
let main = format!("{dir}/main.dino");
|
||||
let main = format!("{dir}/main.rex");
|
||||
let c = driver::compile_file(&main).unwrap_or_else(|e| panic!("{e}"));
|
||||
let exe = driver::temp_exe();
|
||||
driver::build_exe_with(&c, &exe, &["-std=c11", "-fwrapv", "-w", "-fsanitize=address", "-g"]).unwrap();
|
||||
@@ -2203,8 +2203,8 @@ fn docs_examples_run() {
|
||||
}
|
||||
let text = std::fs::read_to_string(&path).unwrap();
|
||||
let mut rest = text.as_str();
|
||||
while let Some(start) = rest.find("```dino\n") {
|
||||
let after = &rest[start + 8..];
|
||||
while let Some(start) = rest.find("```rex\n") {
|
||||
let after = &rest[start + "```rex\n".len()..];
|
||||
let end = after.find("```").unwrap();
|
||||
let code = &after[..end];
|
||||
rest = &after[end + 3..];
|
||||
|
||||
Reference in new issue
Block a user