From c2a7949a3bcc0ee8a06aca25258f0d9489cbfafe Mon Sep 17 00:00:00 2001 From: arthurfiorette Date: Sun, 20 Feb 2022 18:15:52 -0300 Subject: [PATCH] feat: use .brain as file extension (#2) --- README.md | 2 +- src/main.rs | 5 +++++ tests/integration_tests.rs | 4 ++++ .../resources/{goto-directions.bz => goto-directions.brain} | 0 tests/resources/{hello.bz => hello.brain} | 0 tests/resources/{if-simple-test.bz => if-simple-test.brain} | 0 tests/resources/{loop.bz => loop.brain} | 0 7 files changed, 10 insertions(+), 1 deletion(-) rename tests/resources/{goto-directions.bz => goto-directions.brain} (100%) rename tests/resources/{hello.bz => hello.brain} (100%) rename tests/resources/{if-simple-test.bz => if-simple-test.brain} (100%) rename tests/resources/{loop.bz => loop.brain} (100%) diff --git a/README.md b/README.md index e2fe808..07487a2 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ $ cargo install brainease
```r -# brainease -f examples/hello.bz +# brainease -f examples/hello.brain save 'H' at *1 save 'e' at *2 diff --git a/src/main.rs b/src/main.rs index df96eb3..b002415 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,11 @@ fn main() { log::trace!("Cli args: {:?}", args); + if !args.main.ends_with(".brain") { + log::error!("{} does not end with .brain", args.main); + process::exit(1); + } + let (absolute_path, filename) = util::normalize_path(&args.main); log::trace!("Reading '{}'", filename); diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 4eecf7e..d17cd99 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -79,6 +79,10 @@ fn run_resources() -> Result<()> { let files = scan_dir(&Path::new("tests/resources").to_path_buf())?; for (filename, content) in files { + if !filename.ends_with(".brain") { + continue; + } + let instructions = parser::parse_file(&content); let io_handler = TestIoHandler::build_from_file(content.lines().collect()); diff --git a/tests/resources/goto-directions.bz b/tests/resources/goto-directions.brain similarity index 100% rename from tests/resources/goto-directions.bz rename to tests/resources/goto-directions.brain diff --git a/tests/resources/hello.bz b/tests/resources/hello.brain similarity index 100% rename from tests/resources/hello.bz rename to tests/resources/hello.brain diff --git a/tests/resources/if-simple-test.bz b/tests/resources/if-simple-test.brain similarity index 100% rename from tests/resources/if-simple-test.bz rename to tests/resources/if-simple-test.brain diff --git a/tests/resources/loop.bz b/tests/resources/loop.brain similarity index 100% rename from tests/resources/loop.bz rename to tests/resources/loop.brain