1:: Copyright 2018 Google Inc. All rights reserved.
2::
3:: Licensed under the Apache License, Version 2.0 (the "License");
4:: you may not use this file except in compliance with the License.
5:: You may obtain a copy of the License at
6::
7::     http://www.apache.org/licenses/LICENSE-2.0
8::
9:: Unless required by applicable law or agreed to in writing, software
10:: distributed under the License is distributed on an "AS IS" BASIS,
11:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12:: See the License for the specific language governing permissions and
13:: limitations under the License.
14set buildtype=Release
15if "%1"=="-b" set buildtype=%2
16
17cd tests
18call generate_code.bat -b %buildtype% || goto FAIL
19
20:: TODO: Release and Debug builds produce differences here for some reason.
21git checkout HEAD -- monster_test.bfbs
22git checkout HEAD -- arrays_test.bfbs
23
24git -c core.autocrlf=true diff --exit-code --quiet || goto :DIFFFOUND
25goto SUCCESS
26
27:DIFFFOUND
28@echo "" >&2
29@echo "ERROR: ********************************************************" >&2
30@echo "ERROR: The following differences were found after running the" >&2
31@echo "ERROR: tests/generate_code.sh script.  Maybe you forgot to run" >&2
32@echo "ERROR: it after making changes in a generator or schema?" >&2
33@echo "ERROR: ********************************************************" >&2
34@echo "" >&2
35@git -c core.autocrlf=true --no-pager diff --binary
36
37:FAIL
38set EXITCODE=1
39:SUCCESS
40cd ..
41EXIT /B %EXITCODE%