From 77e79f58090b7a457236dcc53794c724b53c5975 Mon Sep 17 00:00:00 2001 From: Charles OuGuo Date: Tue, 24 Jan 2023 22:02:08 -0600 Subject: [PATCH] Factor out proto comparison --- test/parser_binary_test.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/parser_binary_test.sh b/test/parser_binary_test.sh index 863555e..e8bc822 100755 --- a/test/parser_binary_test.sh +++ b/test/parser_binary_test.sh @@ -1,18 +1,21 @@ #!/usr/bin/env bash set -euo pipefail +function compare_proto() { + # Takes one argument, the relative path to the proto to compare. + echo $1 + ./src/parser_binary $1 > "${1}_serialized.proto" + diff --side-by-side --ignore-all-space --ignore-blank-lines $1 "${1}_serialized.proto" +} + echo "Local protos:" LOCAL_PROTOS=$(find ./test/resources -name "*.proto" | sort) for f in $LOCAL_PROTOS; do - echo $f - ./src/parser_binary $f > "${f}_serialized.proto" - diff --side-by-side --ignore-all-space $f "${f}_serialized.proto" + compare_proto $f done echo "Google protos:" GOOGLE_PROTOS=$(find ./external/com_google_protobuf/src/google/protobuf -name "*.proto" | xargs grep --files-without-match "proto2" | sort) for f in $GOOGLE_PROTOS; do - echo $f - ./src/parser_binary $f > "${f}_serialized.proto" - diff --side-by-side --ignore-all-space $f "${f}_serialized.proto" + compare_proto $f done