diff --git a/matlab/src/matlab/+arrow/+io/+csv/TableReader.m b/matlab/src/matlab/+arrow/+io/+csv/TableReader.m index 6e9d925b6bc50..1e0308bb8d4fe 100644 --- a/matlab/src/matlab/+arrow/+io/+csv/TableReader.m +++ b/matlab/src/matlab/+arrow/+io/+csv/TableReader.m @@ -29,7 +29,7 @@ function obj = TableReader(filename) arguments - filename(1, 1) {mustBeNonmissing, mustBeNonzeroLengthText} + filename (1, 1) string {mustBeNonmissing, mustBeNonzeroLengthText} end args = struct(Filename=filename); diff --git a/matlab/src/matlab/+arrow/+io/+csv/TableWriter.m b/matlab/src/matlab/+arrow/+io/+csv/TableWriter.m index 351426b1d1504..79e3c3efe2f7f 100644 --- a/matlab/src/matlab/+arrow/+io/+csv/TableWriter.m +++ b/matlab/src/matlab/+arrow/+io/+csv/TableWriter.m @@ -27,7 +27,7 @@ methods function obj = TableWriter(filename) arguments - filename(1, 1) {mustBeNonmissing, mustBeNonzeroLengthText} + filename (1, 1) string {mustBeNonmissing, mustBeNonzeroLengthText} end args = struct(Filename=filename); diff --git a/matlab/test/arrow/io/csv/tError.m b/matlab/test/arrow/io/csv/tError.m index c904393a16659..5961616a74da3 100644 --- a/matlab/test/arrow/io/csv/tError.m +++ b/matlab/test/arrow/io/csv/tError.m @@ -18,7 +18,7 @@ methods(Test) - function EmptyCsvFile(testCase) + function EmptyFile(testCase) import arrow.io.csv.* arrowTableWrite = arrow.table(); @@ -31,6 +31,22 @@ function EmptyCsvFile(testCase) testCase.verifyError(fcn, "arrow:io:csv:FailedToReadTable"); end + function InvalidWriterFilenameType(testCase) + import arrow.io.csv.* + fcn = @() TableWriter(table); + testCase.verifyError(fcn, "MATLAB:validation:UnableToConvert"); + fcn = @() TableWriter(["a", "b"]); + testCase.verifyError(fcn, "MATLAB:validation:IncompatibleSize"); + end + + function InvalidReaderFilenameType(testCase) + import arrow.io.csv.* + fcn = @() TableReader(table); + testCase.verifyError(fcn, "MATLAB:validation:UnableToConvert"); + fcn = @() TableReader(["a", "b"]); + testCase.verifyError(fcn, "MATLAB:validation:IncompatibleSize"); + end + end end \ No newline at end of file