Skip to content

Commit 57fdd30

Browse files
committed
Use EXPECT_THROW to catch exception in test
1 parent 226346a commit 57fdd30

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

test/testTensor.cu

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,7 @@ TEST_F(TensorTest, parseTensorUnsupportedDataType) {
148148
auto r = DTensor<double>::createRandomTensor(nR, nC, nM, -1, 1);
149149
std::string fName = "myTest.dtensor";
150150
r.saveToFile(fName);
151-
try {
152-
auto a = DTensor<char>::parseFromTextFile(fName);
153-
} catch (const std::invalid_argument& _e) {
154-
return;
155-
}
156-
FAIL();
151+
EXPECT_THROW(DTensor<char>::parseFromTextFile(fName), std::invalid_argument);
157152
}
158153

159154
/* ---------------------------------------

0 commit comments

Comments
 (0)