Rename tests to be less redundant

This commit is contained in:
Alex Bethel 2022-08-10 12:32:11 -05:00
parent d50122540b
commit 1f7fcf9fb1

View file

@ -771,14 +771,14 @@ mod tests {
use super::*;
#[test]
fn test_type_def() {
fn type_def() {
assert!(parser(&ParserMeta::default())
.parse("data Suit = Hearts | Spades | Diamonds | Clubs | Other Int;")
.is_ok())
}
#[test]
fn test_inst_def() {
fn inst_def() {
assert!(parser(&ParserMeta::default())
.parse(
"instance Integral Int {
@ -789,7 +789,7 @@ mod tests {
}
#[test]
fn test_class_def() {
fn class_def() {
assert!(parser(&ParserMeta::default())
.parse(
"class Integral i {
@ -800,21 +800,21 @@ mod tests {
}
#[test]
fn test_func_def() {
fn func_def() {
assert!(parser(&ParserMeta::default())
.parse("def subtract (l: Int) (r: Int) : Int = l - r;")
.is_ok())
}
#[test]
fn test_type_alias_def() {
fn type_alias_def() {
assert!(parser(&ParserMeta::default())
.parse("type Thing = Suit;")
.is_ok())
}
#[test]
fn test_unary() {
fn unary() {
assert!(parser(&ParserMeta::default())
.parse(
"def x = -5; // unary - on 5
@ -826,7 +826,7 @@ mod tests {
}
#[test]
fn test_binary() {
fn binary() {
assert!(parser(&ParserMeta::default())
.parse(
"def x = 2 + 2;
@ -837,7 +837,7 @@ mod tests {
}
#[test]
fn test_app() {
fn app() {
assert!(parser(&ParserMeta::default())
.parse(
"def x = sin x;
@ -847,136 +847,136 @@ mod tests {
}
#[test]
fn test_let() {
fn let_expr() {
assert!(parser(&ParserMeta::default())
.parse("def x = let z = 5 in z;")
.is_ok())
}
#[test]
fn test_match() {
fn match_expr() {
assert!(parser(&ParserMeta::default())
.parse("def x = match foo { \"hi\" => 123 };")
.is_ok())
}
#[test]
fn test_record() {
fn record() {
assert!(parser(&ParserMeta::default())
.parse("def x = { hello: \"World\", foo: \"Bar\" };")
.is_ok())
}
#[test]
fn test_lambda() {
fn lambda() {
assert!(parser(&ParserMeta::default())
.parse("def x = fn (x: Int) (y: Int) -> x + y;")
.is_ok())
}
#[test]
fn test_dot_sub() {
fn dot_sub() {
assert!(parser(&ParserMeta::default())
.parse("def x = foo.bar.baz;")
.is_ok())
}
#[test]
fn test_bracket_sub() {
fn bracket_sub() {
assert!(parser(&ParserMeta::default())
.parse("def x = foo[bar[baz]][xyz];")
.is_ok())
}
#[test]
fn test_tuple() {
fn tuple() {
assert!(parser(&ParserMeta::default())
.parse("def x = (1, 2, (), (3));")
.is_ok())
}
#[test]
fn test_type_namespace() {
fn type_namespace() {
assert!(parser(&ParserMeta::default())
.parse("def x = foo::bar::baz;")
.is_ok())
}
#[test]
fn test_literals() {
fn literals() {
assert!(parser(&ParserMeta::default())
.parse("def x = \"hello\" + 123 + 123.456;")
.is_ok())
}
#[test]
fn test_type_name() {
fn type_name() {
assert!(parser(&ParserMeta::default())
.parse("type a = Foo;")
.is_ok())
}
#[test]
fn test_type_appl() {
fn type_appl() {
assert!(parser(&ParserMeta::default())
.parse("type a = Something Foo Bar;")
.is_ok())
}
#[test]
fn test_tuple_type() {
fn tuple_type() {
assert!(parser(&ParserMeta::default())
.parse("type a = (Int, String);")
.is_ok())
}
#[test]
fn test_record_type() {
fn record_type() {
assert!(parser(&ParserMeta::default())
.parse("type a = {foo: String, bar: Int};")
.is_ok())
}
#[test]
fn test_capture_pat() {
fn capture_pat() {
assert!(parser(&ParserMeta::default()).parse("def foo a;").is_ok())
}
#[test]
fn test_tuple_pat() {
fn tuple_pat() {
assert!(parser(&ParserMeta::default())
.parse("def foo (a, b);")
.is_ok())
}
#[test]
fn test_record_pat() {
fn record_pat() {
assert!(parser(&ParserMeta::default())
.parse("def foo { a: x, b, ... };")
.is_ok())
}
#[test]
fn test_type_annot() {
fn type_annot() {
assert!(parser(&ParserMeta::default())
.parse("def foo (a: String);")
.is_ok())
}
#[test]
fn test_destructure() {
fn destructure() {
assert!(parser(&ParserMeta::default())
.parse("def foo (Just a);")
.is_ok())
}
#[test]
fn test_ignore_pat() {
fn ignore_pat() {
assert!(parser(&ParserMeta::default()).parse("def foo _;").is_ok())
}
#[test]
fn test_literal_pat() {
fn literal_pat() {
assert!(parser(&ParserMeta::default())
.parse("def foo \"x\";")
.is_ok())