mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
Catch roff parse errors when checking for grid data
This commit is contained in:
1 parent
17e8c96e00
commit
0db64b400b
2 files changed
+32
-9
No files matched your search
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QTemporaryDir>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@@ -179,6 +180,20 @@ TEST( RifRoffFileTools, HasGridDataFalseForMissingFile )
|
||||
EXPECT_FALSE( RifRoffFileTools::hasGridData( filePath ) );
|
||||
}
|
||||
|
||||
TEST( RifRoffFileTools, HasGridDataFalseForMalformedFile )
|
||||
{
|
||||
QTemporaryDir tempDir;
|
||||
ASSERT_TRUE( tempDir.isValid() );
|
||||
|
||||
auto filePath = tempDir.filePath( "malformed.roff" );
|
||||
QFile file( filePath );
|
||||
ASSERT_TRUE( file.open( QIODevice::WriteOnly ) );
|
||||
file.write( "this is not a roff file" );
|
||||
file.close();
|
||||
|
||||
EXPECT_FALSE( RifRoffFileTools::hasGridData( filePath ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// openGridFile on a stream is the entry point used when the roff data is not a file on disk, e.g. a
|
||||
// blob downloaded from Sumo.
|
||||
|
||||
Reference in new issue
Block a user