strykelang 0.9.1

A highly parallel Perl 5 interpreter written in Rust
Documentation
use crate::common::*;
use stryke::error::ErrorKind;

#[test]
fn parse_unclosed_brace_is_syntax_error() {
    let err = stryke::parse("fn f {").unwrap_err();
    assert_eq!(err.kind, ErrorKind::Syntax);
}

#[test]
fn parse_lone_brace_is_syntax_error() {
    assert_eq!(parse_err_kind("}"), ErrorKind::Syntax);
}

#[test]
fn division_by_zero_is_runtime_error() {
    assert_eq!(eval_err_kind("1 / 0"), ErrorKind::Runtime);
}

#[test]
fn modulus_zero_is_runtime_error() {
    assert_eq!(eval_err_kind("1 % 0"), ErrorKind::Runtime);
}

#[test]
fn die_is_die_kind() {
    assert_eq!(eval_err_kind(r#"die "stop""#), ErrorKind::Die);
}

#[test]
fn exit_zero_is_exit_kind() {
    assert_eq!(eval_err_kind("exit(0)"), ErrorKind::Exit(0));
}

#[test]
fn unterminated_double_quoted_string_is_syntax_error() {
    assert_eq!(parse_err_kind(r#"my $x = "unfinished"#), ErrorKind::Syntax);
}

#[test]
fn unexpected_eof_after_operator_is_syntax_error() {
    assert_eq!(parse_err_kind("++"), ErrorKind::Syntax);
}