Merge pull request #2175 from xfxyjwf/fix_json

Fix VS test failures.
pull/2176/head
Feng Xiao 8 years ago committed by GitHub
commit 87d61e44fa
  1. 2
      jenkins/docker/Dockerfile
  2. 8
      src/google/protobuf/stubs/type_traits.h
  3. 22
      src/google/protobuf/util/internal/json_stream_parser_test.cc

@ -115,7 +115,7 @@ RUN cd /tmp && \
cd protobuf && \ cd protobuf && \
./autogen.sh && \ ./autogen.sh && \
./configure && \ ./configure && \
make -j7 && \ make -j4 && \
cd java && \ cd java && \
$MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \ $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
cd ../javanano && \ cd ../javanano && \

@ -143,6 +143,14 @@ template<> struct is_integral<unsigned long> : true_type { };
template<> struct is_integral<long long> : true_type { }; template<> struct is_integral<long long> : true_type { };
template<> struct is_integral<unsigned long long> : true_type { }; template<> struct is_integral<unsigned long long> : true_type { };
#endif #endif
#if defined(_MSC_VER)
// With VC, __int8, __int16, and __int32 are synonymous with standard types
// with the same size, but __int64 has not equivalent (i.e., it's neither
// long, nor long long and should be treated differnetly).
// https://msdn.microsoft.com/en-us/library/29dh1w7z.aspx
template<> struct is_integral<__int64> : true_type { };
template<> struct is_integral<unsigned __int64> : true_type {};
#endif
template <class T> struct is_integral<const T> : is_integral<T> { }; template <class T> struct is_integral<const T> : is_integral<T> { };
template <class T> struct is_integral<volatile T> : is_integral<T> { }; template <class T> struct is_integral<volatile T> : is_integral<T> { };
template <class T> struct is_integral<const volatile T> : is_integral<T> { }; template <class T> struct is_integral<const volatile T> : is_integral<T> { };

@ -315,18 +315,28 @@ TEST_F(JsonStreamParserTest, ObjectKeyTypes) {
} }
} }
// - array containing array, object, values (true, false, null, num, string) // - array containing primitive values (true, false, null, num, string)
TEST_F(JsonStreamParserTest, ArrayValues) { TEST_F(JsonStreamParserTest, ArrayPrimitiveValues) {
StringPiece str = StringPiece str =
"[true, false, null, 'a', \"an\", [22, -127, 45.3, " "[true, false, null, 'one', \"two\"]";
"-1056.4, 11779497823553162765], {'key': true}]";
for (int i = 0; i <= str.length(); ++i) { for (int i = 0; i <= str.length(); ++i) {
ow_.StartList("") ow_.StartList("")
->RenderBool("", true) ->RenderBool("", true)
->RenderBool("", false) ->RenderBool("", false)
->RenderNull("") ->RenderNull("")
->RenderString("", "a") ->RenderString("", "one")
->RenderString("", "an") ->RenderString("", "two")
->EndList();
DoTest(str, i);
}
}
// - array containing array, object
TEST_F(JsonStreamParserTest, ArrayComplexValues) {
StringPiece str =
"[[22, -127, 45.3, -1056.4, 11779497823553162765], {'key': true}]";
for (int i = 0; i <= str.length(); ++i) {
ow_.StartList("")
->StartList("") ->StartList("")
->RenderUint64("", 22) ->RenderUint64("", 22)
->RenderInt64("", -127) ->RenderInt64("", -127)

Loading…
Cancel
Save