Skip to content

Commit

Permalink
update expected error ID in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanpo committed Oct 22, 2024
1 parent fb12908 commit cc03693
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions test/autotrace_examples/example1/generate_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

% Copyright 2024 The MathWorks, Inc.

% check input is valid
if ~(isnumeric(n) && isscalar(n))
error("autotrace_examples:example1:generate_data:InvalidN", ...
"Input must be a numeric scalar");
end

% generate some random data
a = 1.5;
b = 0.8;
Expand Down
4 changes: 2 additions & 2 deletions test/tautotrace.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function testError(testCase)
at = opentelemetry.autoinstrument.AutoTrace(@example1);

% run the example with an invalid input, check for error
verifyError(testCase, @()beginTrace(at, "invalid"), "MATLAB:colon:inputsMustBeNumericCharLogical");
verifyError(testCase, @()beginTrace(at, "invalid"), "autotrace_examples:example1:generate_data:InvalidN");

% perform test comparisons
results = readJsonResults(testCase);
Expand Down Expand Up @@ -195,7 +195,7 @@ function testHandleError(testCase)

% call example directly instead of calling beginTrace, and pass
% in an invalid input
verifyError(testCase, @()example1_trycatch(at, "invalid"), "MATLAB:colon:inputsMustBeNumericCharLogical");
verifyError(testCase, @()example1_trycatch(at, "invalid"), "autotrace_examples:example1:generate_data:InvalidN");

% perform test comparisons
results = readJsonResults(testCase);
Expand Down

0 comments on commit cc03693

Please sign in to comment.