Skip to content

Commit

Permalink
replace regexp to ismember due to octave bug 57107; test mac
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 8, 2023
1 parent 67065dc commit 9173525
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Octave tests
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, windows-2019]
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-11, windows-2019]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -18,15 +18,15 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies (Linux only)
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get update && sudo apt-get install -y octave
- name: Install dependencies (Windows only)
if: ${{ runner.os == 'Windows' }}
- name: Install dependencies
run: |
curl --retry 3 -kL http://cdimage.debian.org/mirror/gnu.org/gnu/octave/windows/octave-5.2.0_1-w64-64.7z --output octave_5.2.7z
7z x octave_5.2.7z -ooctave -y
echo "$PWD/octave/octave-5.2.0-w64-64/mingw64/bin" >> $GITHUB_PATH
[[ "$RUNNER_OS" == "Linux" ]] && sudo apt-get update && sudo apt-get install -y octave
[[ "$RUNNER_OS" == "macOS" ]] && brew install octave
if [[ "$RUNNER_OS" == "Windows" ]]; then
curl --retry 3 -kL http://cdimage.debian.org/mirror/gnu.org/gnu/octave/windows/octave-8.1.0-w64-64.7z --output octave_8.1.7z
7z x octave_8.1.7z -ooctave -y
echo "$PWD/octave/octave-8.1.0-w64-64/mingw64/bin" >> $GITHUB_PATH
fi
- name: Run octave test
run: |
octave-cli --version
Expand Down
3 changes: 2 additions & 1 deletion encodevarname.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
if(exist('unicode2native','builtin'))
str=regexprep(str,'([^0-9A-Za-z_])','_0x${sprintf(''%X'',unicode2native($1))}_');
else
cpos=regexp(str,'[^0-9A-Za-z_]');
cpos=find(~ismember(str, ['0':'9','A':'Z','a':'z','_']));
%cpos=regexp(str,'[^0-9A-Za-z_]');
if(isempty(cpos))
return;
end
Expand Down
2 changes: 1 addition & 1 deletion loadbj.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
fid = fopen(fname,'rb');
string = fread(fid,jsonopt('MaxBuffer',inf,opt),'uint8=>char')';
fclose(fid);
elseif(length(fname) && ~isempty(find(fname(1)=='[{SCHiUIulmLMhdDTFZN]')))
elseif(length(fname) && any(fname(1)=='[{SCHiUIulmLMhdDTFZN'))
string=fname;
else
error_pos('input file does not exist or buffer is invalid');
Expand Down
5 changes: 4 additions & 1 deletion test/run_jsonlab_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function run_jsonlab_test(tests)
% run_jsonlab_test
% or
% run_jsonlab_test(tests)
% run_jsonlab_test({'js','jso','bj','bjo'})
% run_jsonlab_test({'js','jso','bj','bjo','jmap','bmap','bugs'})
%
% Unit testing for JSONLab JSON, BJData/UBJSON encoders and decoders
%
Expand All @@ -16,6 +16,9 @@ function run_jsonlab_test(tests)
% 'jso': test savejson/loadjson special options
% 'bj': test savebj/loadbj
% 'bjo': test savebj/loadbj special options
% 'jmap': test jsonmmap features in loadjson
% 'bmap': test jsonmmap features in loadbj
% 'bugs': test specific bug fixes
%
% license:
% BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details
Expand Down

0 comments on commit 9173525

Please sign in to comment.