Skip to content

Commit

Permalink
1. Set access for Filename property of TableWriter.
Browse files Browse the repository at this point in the history
2. Add more error tests.

Co-authored-by: Sarah Gilmore <[email protected]>
  • Loading branch information
kevingurney and sgilmore10 committed Sep 18, 2023
1 parent 66744a2 commit bedaf98
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion matlab/src/matlab/+arrow/+io/+csv/TableWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Proxy
end

properties(Dependent)
properties(Dependent, SetAccess=private, GetAccess=public)
Filename
end

Expand All @@ -36,6 +36,10 @@
end

function write(obj, table)
arguments
obj (1, 1) arrow.io.csv.TableWriter
table (1, 1) arrow.tabular.Table
end
args = struct(TableProxyID=table.Proxy.ID);
obj.Proxy.write(args);
end
Expand Down
21 changes: 21 additions & 0 deletions matlab/test/arrow/io/csv/tError.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@ function InvalidReaderFilenameType(testCase)
testCase.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
end

function InvalidWriterWriteType(testCase)
import arrow.io.csv.*
writer = TableWriter(testCase.Filename);
fcn = @() writer.write("text");
testCase.verifyError(fcn, "MATLAB:validation:UnableToConvert");
end

function WriterFilenameNoSetter(testCase)
import arrow.io.csv.*
writer = TableWriter(testCase.Filename);
fcn = @() setfield(writer, "Filename", "filename.csv");
testCase.verifyError(fcn, "MATLAB:class:SetProhibited");
end

function ReaderFilenameNoSetter(testCase)
import arrow.io.csv.*
reader = TableReader(testCase.Filename);
fcn = @() setfield(reader, "Filename", "filename.csv");
testCase.verifyError(fcn, "MATLAB:class:SetProhibited");
end

end

end

0 comments on commit bedaf98

Please sign in to comment.