File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ instance IsString Module where
3333 fromString = Module
3434
3535instance FromValue Module where
36- fromValue = fmap Module . fromValue
36+ fromValue v = do
37+ r <- fromValue v
38+ case words r of
39+ [name] -> return (Module name)
40+ _ -> warn (" invalid module name " <> show r) >> return (Module r)
3741
3842toModule :: Path -> Module
3943toModule path = case reverse $ Path. components path of
Original file line number Diff line number Diff line change @@ -70,6 +70,17 @@ spec = around_ (inTempDirectoryNamed "foo") $ do
7070 " package.yaml: Duplicate field $.name"
7171 ]
7272
73+ context " when a module name contains spaces" $ do
74+ it " warns" $ do
75+ [i |
76+ name: foo
77+ library:
78+ other-modules:
79+ Foo
80+ Bar
81+ Baz
82+ |] `shouldWarn` [" package.yaml: invalid module name \" Foo Bar Baz\" in $.library.other-modules" ]
83+
7384 describe " handling of Paths_ module" $ do
7485 it " adds Paths_ to other-modules" $ do
7586 [i |
You can’t perform that action at this time.
0 commit comments