Skip to content

Commit 4275c70

Browse files
committed
Add tests for status
1 parent 1162084 commit 4275c70

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

cpp/src/arrow/util/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ endif()
7070
ADD_ARROW_TEST(bit-util-test)
7171
ADD_ARROW_TEST(buffer-test)
7272
ADD_ARROW_TEST(memory-pool-test)
73+
ADD_ARROW_TEST(status-test)

cpp/src/arrow/util/status-test.cc

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
#include <glog/logging.h>
19+
#include <gtest/gtest.h>
20+
21+
#include "arrow/util/status.h"
22+
#include "arrow/test-util.h"
23+
24+
namespace arrow {
25+
26+
TEST(StatusTest, TestCodeAndMessage) {
27+
Status ok = Status::OK();
28+
ASSERT_EQ(StatusCode::OK, ok.code());
29+
Status file_error = Status::IOError("file error");
30+
ASSERT_EQ(StatusCode::IOError, file_error.code());
31+
ASSERT_EQ("file error", file_error.message());
32+
}
33+
34+
TEST(StatusTest, TestToString) {
35+
Status file_error = Status::IOError("file error");
36+
ASSERT_EQ("IOError: file error", file_error.ToString());
37+
}
38+
39+
} // namespace arrow

0 commit comments

Comments
 (0)