various fixes
- removed experimental test lib - fixed watch not outputting errors - updated examples - added TODOs for when standard is made public
This commit is contained in:
parent
32acd5e888
commit
e7433e42db
9 changed files with 16 additions and 18 deletions
|
@ -1,9 +0,0 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void assert_eq_int(int left, int right) {
|
|
||||||
if (left != right) {
|
|
||||||
printf("assertion failed\n'%i' != '%i'\n", left, right);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int a;
|
int a = 3;
|
||||||
printf("hello, world!! %d\n", a);
|
printf("hello, world!\n");
|
||||||
|
printf("a: %d\n", a);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hello = 35;
|
int hello = 35;
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int a;
|
int a;
|
||||||
printf("hello, world!! %d\n", a);
|
printf("hello, world!\n");
|
||||||
|
printf("a: %d\n", a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../../clib/test.h"
|
|
||||||
|
|
||||||
void test_it_works() {
|
void test_it_works() {
|
||||||
assert_eq_int(2 + 2, 4);
|
assert(2 + 2 == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_it_fails() {
|
void test_it_fails() {
|
||||||
assert_eq_int(2 + 2, 5);
|
assert(2 + 2 == 5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::{
|
||||||
utils::{log_failure, log_process},
|
utils::{log_failure, log_process},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// TODO: fill with appropriate rules
|
||||||
const FORMAT_CONFIG: &str = r#"{BasedOnStyle: llvm}"#;
|
const FORMAT_CONFIG: &str = r#"{BasedOnStyle: llvm}"#;
|
||||||
|
|
||||||
mod testables;
|
mod testables;
|
||||||
|
|
|
@ -27,6 +27,7 @@ impl Rule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TODO: fill with appropriate rules
|
||||||
pub fn tests() -> Vec<Rule> {
|
pub fn tests() -> Vec<Rule> {
|
||||||
vec![
|
vec![
|
||||||
// rules
|
// rules
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
tasks::{CompileTask, RunTask},
|
tasks::{CompileTask, RunTask},
|
||||||
utils::{log_failure, log_process, log_success},
|
utils::{log_failure, log_process},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main(files: Vec<String>, flags: Vec<String>) -> Option<()> {
|
pub fn main(files: Vec<String>, flags: Vec<String>) -> Option<()> {
|
||||||
let source_file = files.into_iter().map(|f| f.into()).collect();
|
let source_file = files.into_iter().map(|f| f.into()).collect();
|
||||||
log_process("compiling");
|
log_process("compiling");
|
||||||
let mut task = CompileTask::new(source_file);
|
let mut task = CompileTask::new(source_file);
|
||||||
|
|
||||||
for flag in flags {
|
for flag in flags {
|
||||||
task = task.with_flag(flag);
|
task = task.with_flag(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
let compiled = task.run().map(Option::from).unwrap_or_else(|_| {
|
let compiled = task.run().map(Option::from).unwrap_or_else(|_| {
|
||||||
log_failure("compilation failed");
|
log_failure("compilation failed");
|
||||||
None
|
None
|
||||||
})?;
|
})?;
|
||||||
log_success("finished");
|
|
||||||
log_process("running");
|
log_process("running");
|
||||||
RunTask::new(compiled)
|
RunTask::new(compiled)
|
||||||
.run()
|
.run()
|
||||||
|
|
|
@ -166,6 +166,7 @@ impl CmdTask {
|
||||||
Command::new("sh")
|
Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(self.command)
|
.arg(self.command)
|
||||||
|
.stderr(Stdio::inherit())
|
||||||
.stdout(Stdio::inherit())
|
.stdout(Stdio::inherit())
|
||||||
.output()
|
.output()
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main(_capture: bool, files: Vec<String>, args: Vec<String>, _test: Option<Vec<String>>) {
|
pub fn main(_capture: bool, files: Vec<String>, args: Vec<String>, _test: Option<Vec<String>>) {
|
||||||
log_process("running tests");
|
log_process("testing");
|
||||||
for path in files {
|
for path in files {
|
||||||
let content = fs::read_to_string(&path).unwrap();
|
let content = fs::read_to_string(&path).unwrap();
|
||||||
let tests = find_tests(content);
|
let tests = find_tests(content);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue