Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
3f5d3144
Commit
3f5d3144
authored
Jul 02, 2018
by
Hugo Beauzée-Luyssen
Browse files
tests: fs mock: Raise an assertion when a folder/file can't be found
This matches the unix fs actual implementation
parent
30dccc88
Changes
3
Hide whitespace changes
Inline
Side-by-side
test/mocks/FileSystem.h
View file @
3f5d3144
...
...
@@ -165,7 +165,7 @@ struct FileSystemFactory : public fs::IFileSystemFactory
{
auto
d
=
device
(
mrl
);
if
(
d
==
nullptr
)
return
std
::
make_shared
<
Directory
>
(
""
,
nullptr
)
;
throw
std
::
system_error
{
ENOENT
,
std
::
generic_category
(),
"Mock directory"
}
;
auto
dir
=
d
->
directory
(
mrl
);
if
(
dir
==
nullptr
)
throw
std
::
system_error
{
ENOENT
,
std
::
generic_category
(),
"Mock directory"
};
...
...
test/mocks/filesystem/MockDevice.cpp
View file @
3f5d3144
...
...
@@ -25,6 +25,7 @@
#endif
#include
<cassert>
#include
<system_error>
#include
"MockDevice.h"
#include
"MockDirectory.h"
...
...
@@ -106,7 +107,7 @@ std::shared_ptr<File> Device::file(const std::string& filePath )
std
::
shared_ptr
<
Directory
>
Device
::
directory
(
const
std
::
string
&
path
)
{
if
(
m_root
==
nullptr
||
m_present
==
false
)
return
std
::
make_shared
<
Directory
>
(
""
,
nullptr
)
;
throw
std
::
system_error
{
ENOENT
,
std
::
generic_category
(),
"Mock directory"
}
;
const
auto
relPath
=
relativePath
(
path
);
if
(
relPath
.
empty
()
==
true
)
return
m_root
;
...
...
test/mocks/filesystem/MockDirectory.cpp
View file @
3f5d3144
...
...
@@ -152,7 +152,7 @@ std::shared_ptr<Directory> Directory::directory(const std::string& path)
{
auto
it
=
m_dirs
.
find
(
subFolder
);
if
(
it
==
end
(
m_dirs
)
)
return
std
::
make_shared
<
Directory
>
(
""
,
nullptr
)
;
throw
std
::
system_error
{
ENOENT
,
std
::
generic_category
(),
"Mock directory"
}
;
return
it
->
second
;
}
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment