test data in arrays, not vec!

This commit is contained in:
Jörn-Michael Miehe 2025-07-03 15:43:26 +00:00
parent cca35e1ae8
commit cab6d13d28
3 changed files with 9 additions and 9 deletions

View file

@ -106,7 +106,7 @@ mod tests {
#[test] #[test]
fn basic_traits_working() { fn basic_traits_working() {
let inputs = vec![ let inputs = [
"", "",
"abcd", "abcd",
"12345", "12345",
@ -142,7 +142,7 @@ mod tests {
#[test] #[test]
fn valid_urls_produce_expected_file_id() { fn valid_urls_produce_expected_file_id() {
// a handful of validlooking URLs // a handful of validlooking URLs
let cases = vec![ let cases = [
( (
"http://example.com/api/v2/alias/upload/SID123/files/tus/FID456", "http://example.com/api/v2/alias/upload/SID123/files/tus/FID456",
"FID456", "FID456",
@ -169,7 +169,7 @@ mod tests {
#[test] #[test]
fn invalid_urls_return_error() { fn invalid_urls_return_error() {
let bad_inputs = vec![ let bad_inputs = [
// missing /api/v2/alias/upload // missing /api/v2/alias/upload
"http://example.com/files/tus/FID", "http://example.com/files/tus/FID",
// missing /files/tus // missing /files/tus

View file

@ -59,7 +59,7 @@ mod tests {
#[test] #[test]
fn nsreq_new_sets_fields_correctly() { fn nsreq_new_sets_fields_correctly() {
let cases: Vec<(&str, u32)> = vec![ let cases = [
// simple ASCII name, small view count // simple ASCII name, small view count
("alice", 1), ("alice", 1),
// underscores, mid-range views // underscores, mid-range views
@ -95,7 +95,7 @@ mod tests {
fn nsreq_new_allows_setting_description() { fn nsreq_new_allows_setting_description() {
let longstr = "y".repeat(256); let longstr = "y".repeat(256);
let cases = vec![ let cases = [
// simple alphanumeric // simple alphanumeric
"A simple test user", "A simple test user",
// whitespace & punctuation // whitespace & punctuation

View file

@ -104,7 +104,7 @@ mod tests {
#[test] #[test]
fn basic_traits_working() { fn basic_traits_working() {
let cases = vec![ let cases = [
// simple http host // simple http host
"http://example.com", "http://example.com",
// https host with port // https host with port
@ -122,7 +122,7 @@ mod tests {
#[test] #[test]
fn valid_urls_produce_expected_uri() { fn valid_urls_produce_expected_uri() {
let cases = vec![ let cases = [
// simple http host // simple http host
("http://example.com", "http://example.com"), ("http://example.com", "http://example.com"),
// https host with port // https host with port
@ -143,7 +143,7 @@ mod tests {
#[test] #[test]
fn invalid_urls_passed_through() { fn invalid_urls_passed_through() {
let cases = vec![ let cases = [
// missing “://” // missing “://”
"http:/example.com", "http:/example.com",
// missing scheme // missing scheme
@ -165,7 +165,7 @@ mod tests {
#[test] #[test]
fn test_endpoint() { fn test_endpoint() {
let cases = vec![ let cases = [
// simple path // simple path
("path/to/something", "/api/v2/path/to/something"), ("path/to/something", "/api/v2/path/to/something"),
// underscores, hyphens, dots // underscores, hyphens, dots