|
98 | 98 | end |
99 | 99 |
|
100 | 100 | #------------------------------------------------------------------------------- |
| 101 | +function load_list(filename) |
| 102 | + lines = eachline(joinpath(@__DIR__, filename)) |
| 103 | + filter(!isempty, strip.(lines)) |
| 104 | +end |
101 | 105 | @testset "Data set name parsing" begin |
102 | | - @testset "Valid name: $name" for name in ( |
103 | | - "a_b", "a-b", "a1", "δεδομένα", "a/b", "a/b/c", "a-", "b_", |
104 | | - "1", "a/1", "123", "12ab/34cd", "1/2/3", "1-2-3", "x_-__", "a---", |
105 | | - ) |
106 | | - @test DataSets.check_dataset_name(name) === nothing |
107 | | - @test DataSets._split_dataspec(name) == (name, nothing, nothing) |
| 106 | + @testset "Valid names" begin |
| 107 | + valid_names = load_list("dataset-names-valid.txt") |
| 108 | + @test length(valid_names) == 16 |
| 109 | + @testset "Valid name: $name" for name in valid_names |
| 110 | + @test DataSets.check_dataset_name(name) === nothing |
| 111 | + @test DataSets._split_dataspec(name) == (name, nothing, nothing) |
| 112 | + end |
108 | 113 | end |
109 | 114 |
|
110 | | - @testset "Invalid name: $name" for name in ( |
111 | | - "a b", "a.b", "a/b/", "a//b", "/a/b", "a/-", "a/ _/b", |
112 | | - "a/-a", "a/-1", |
113 | | - ) |
114 | | - @test_throws ErrorException DataSets.check_dataset_name(name) |
115 | | - @test DataSets._split_dataspec(name) == (nothing, nothing, nothing) |
| 115 | + @testset "Invalid names" begin |
| 116 | + invalid_names = load_list("dataset-names-invalid.txt") |
| 117 | + @test length(invalid_names) == 9 |
| 118 | + @testset "Invalid name: $name" for name in invalid_names |
| 119 | + @test_throws ErrorException DataSets.check_dataset_name(name) |
| 120 | + @test DataSets._split_dataspec(name) == (nothing, nothing, nothing) |
| 121 | + end |
116 | 122 | end |
117 | 123 | end |
118 | 124 |
|
|
0 commit comments