@@ -105,19 +105,47 @@ end
105105@testset " Data set name parsing" begin
106106 @testset " Valid names" begin
107107 valid_names = load_list (" dataset-names-valid.txt" )
108- @test length (valid_names) == 16
108+ @test ! isempty (valid_names)
109109 @testset " Valid name: $name " for name in valid_names
110110 @test DataSets. check_dataset_name (name) === nothing
111111 @test DataSets. _split_dataspec (name) == (name, nothing , nothing )
112+ # Also test that the name is still valid when it appears as part of
113+ # a path elements.
114+ let path_name = " foo/$(name) "
115+ @test DataSets. check_dataset_name (path_name) === nothing
116+ @test DataSets. _split_dataspec (path_name) == (path_name, nothing , nothing )
117+ end
118+ let path_name = " $(name) /foo"
119+ @test DataSets. check_dataset_name (path_name) === nothing
120+ @test DataSets. _split_dataspec (path_name) == (path_name, nothing , nothing )
121+ end
122+ let path_name = " foo/$(name) /bar"
123+ @test DataSets. check_dataset_name (path_name) === nothing
124+ @test DataSets. _split_dataspec (path_name) == (path_name, nothing , nothing )
125+ end
112126 end
113127 end
114128
115129 @testset " Invalid names" begin
116130 invalid_names = load_list (" dataset-names-invalid.txt" )
117- @test length (invalid_names) == 9
131+ @test ! isempty (invalid_names)
118132 @testset " Invalid name: $name " for name in invalid_names
119133 @test_throws ErrorException DataSets. check_dataset_name (name)
120134 @test DataSets. _split_dataspec (name) == (nothing , nothing , nothing )
135+ # Also test that the name is still invalid when it appears as part of
136+ # a path elements.
137+ let path_name = " foo/$(name) "
138+ @test_throws ErrorException DataSets. check_dataset_name (path_name) === nothing
139+ @test DataSets. _split_dataspec (path_name) == (nothing , nothing , nothing )
140+ end
141+ let path_name = " $(name) /foo"
142+ @test_throws ErrorException DataSets. check_dataset_name (path_name) === nothing
143+ @test DataSets. _split_dataspec (path_name) == (nothing , nothing , nothing )
144+ end
145+ let path_name = " foo/$(name) /bar"
146+ @test_throws ErrorException DataSets. check_dataset_name (path_name) === nothing
147+ @test DataSets. _split_dataspec (path_name) == (nothing , nothing , nothing )
148+ end
121149 end
122150 end
123151end
0 commit comments