Test suite works with new syntax

This commit is contained in:
Robert Bendun 2022-10-25 16:20:24 +02:00
parent 8cda4f4d8e
commit 0529a84fb7
5 changed files with 20 additions and 11 deletions

View File

@ -31,6 +31,7 @@ extern "C" {
namespace fs = std::filesystem;
static bool quiet_mode = false;
static bool ast_only_mode = false;
static bool enable_repl = false;
static unsigned repl_line_number = 1;
@ -173,10 +174,14 @@ struct Runner
interpreter.midi_connection = &midi;
if (output_port) {
midi.connect_output(*output_port);
std::cout << "Connected MIDI output to port " << *output_port << ". Ready to play!" << std::endl;
if (!quiet_mode) {
std::cout << "Connected MIDI output to port " << *output_port << ". Ready to play!" << std::endl;
}
} else {
midi.connect_output();
std::cout << "Created new MIDI output port 'Musique'. Ready to play!" << std::endl;
if (!quiet_mode) {
std::cout << "Created new MIDI output port 'Musique'. Ready to play!" << std::endl;
}
}
Env::global->force_define("say", +[](Interpreter &interpreter, std::vector<Value> args) -> Result<Value> {
@ -389,6 +394,10 @@ static std::optional<Error> Main(std::span<char const*> args)
continue;
}
if (arg == "--quiet" || arg == "-q") {
quiet_mode = true;
continue;
}
if (arg == "--ast") {
ast_only_mode = true;
continue;

View File

@ -10,5 +10,5 @@ say (false and 4);
say (true and 4);
-- Test lazy evaluation
(say 32; false) and (say 42);
(say 32; true) and (say 42);
call (say 32; false) and (say 42);
call (say 32; true) and (say 42);

View File

@ -9,5 +9,5 @@ say (0 or 0);
say (4 or 3);
-- Test lazy evaluation
(say 42; false) or say 10;
(say 42; true) or say 10;
call (say 42; false) or say 10;
call (say 42; true) or say 10;

View File

@ -26,8 +26,8 @@ say (permute 3 2 1 0);
-- This array should be flattened to support case (permute array)
say (permute 3 2 [1; 0]);
say (permute 3 2 (1; 0));
-- Test if nested arrays are preserved
say (permute [[3; 2]; 4] [1; 0]);
say (permute [0; 1; 4; [3; 2]]);
say (permute ((3; 2); 4) (1; 0));
say (permute (0; 1; 4; (3; 2)));

View File

@ -5,7 +5,7 @@ import os
import subprocess
TEST_DB = "test_db.json"
INTERPRETER = "bin/debug/musique"
INTERPRETER = "bin/linux/debug/musique"
@dataclasses.dataclass
class Result:
@ -24,7 +24,7 @@ class TestCase:
def run(self, interpreter: str, source: str, cwd: str):
result = subprocess.run(
args=[interpreter, source],
args=[interpreter, source, "-q"],
capture_output=True,
cwd=cwd,
text=True