~ubuntu-branches/ubuntu/quantal/protobuf/quantal

« back to all changes in this revision

Viewing changes to src/google/protobuf/compiler/parser_unittest.cc

  • Committer: Bazaar Package Importer
  • Author(s): Manny Vindiola
  • Date: 2008-12-18 01:26:29 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081218012629-l93kqt3jptydn9zh
Tags: 2.0.3-0ubuntu1
* Merge from new upstream version (LP: #309237), remaining changes:
   * debian/control Moving python-support from Build-Depends-Indep
     to Build-Depends to fix build failures.  
* Fix FTBFS on ia64 architecture due to lack of clone(2)
   - src/gtest/internal/gtest-port.h (LP: #308829)
     disable death tests if architecture is IA64
     adapted from gtest upstream fix at:
     http://codereview.appspot.com/8690/show
* Fix FTBFS on x64 architectures due to python 2.x int vs long issue
  test expects return type long but on x64 architecture return type 
  unpacks to int
   -python/google/protobuf/internal/decoder_test.py
    explicitly type the result value as long 
   taken from upstream discussion:
   http://groups.google.com/group/protobuf/browse_thread
       /thread/2357176cb1f50e10/

Show diffs side-by-side

added added

removed removed

Lines of Context:
305
305
    "  required double foo = 1 [default=-11.5];\n"
306
306
    "  required double foo = 1 [default= 12  ];\n"
307
307
    "  required string foo = 1 [default='13\\001'];\n"
 
308
    "  required string foo = 1 [default='a' \"b\" \n \"c\"];\n"
308
309
    "  required bytes  foo = 1 [default='14\\002'];\n"
 
310
    "  required bytes  foo = 1 [default='a' \"b\" \n 'c'];\n"
309
311
    "  required bool   foo = 1 [default=true ];\n"
310
312
    "  required Foo    foo = 1 [default=FOO  ];\n"
311
313
 
334
336
    "  field { type:TYPE_DOUBLE  default_value:\"-11.5\"     "ETC" }"
335
337
    "  field { type:TYPE_DOUBLE  default_value:\"12\"        "ETC" }"
336
338
    "  field { type:TYPE_STRING  default_value:\"13\\001\"   "ETC" }"
 
339
    "  field { type:TYPE_STRING  default_value:\"abc\"       "ETC" }"
337
340
    "  field { type:TYPE_BYTES   default_value:\"14\\\\002\" "ETC" }"
 
341
    "  field { type:TYPE_BYTES   default_value:\"abc\"       "ETC" }"
338
342
    "  field { type:TYPE_BOOL    default_value:\"true\"      "ETC" }"
339
343
    "  field { type_name:\"Foo\" default_value:\"FOO\"       "ETC" }"
340
344
 
534
538
    "}");
535
539
}
536
540
 
 
541
TEST_F(ParseEnumTest, ValueOptions) {
 
542
  ExpectParsesTo(
 
543
    "enum TestEnum {\n"
 
544
    "  FOO = 13;\n"
 
545
    "  BAR = -10 [ (something.text) = 'abc' ];\n"
 
546
    "  BAZ = 500 [ (something.text) = 'def', other = 1 ];\n"
 
547
    "}\n",
 
548
 
 
549
    "enum_type {"
 
550
    "  name: \"TestEnum\""
 
551
    "  value { name: \"FOO\" number: 13 }"
 
552
    "  value { name: \"BAR\" number: -10 "
 
553
    "    options { "
 
554
    "      uninterpreted_option { "
 
555
    "        name { name_part: \"something.text\" is_extension: true } "
 
556
    "        string_value: \"abc\" "
 
557
    "      } "
 
558
    "    } "
 
559
    "  } "
 
560
    "  value { name: \"BAZ\" number: 500 "
 
561
    "    options { "
 
562
    "      uninterpreted_option { "
 
563
    "        name { name_part: \"something.text\" is_extension: true } "
 
564
    "        string_value: \"def\" "
 
565
    "      } "
 
566
    "      uninterpreted_option { "
 
567
    "        name { name_part: \"other\" is_extension: false } "
 
568
    "        positive_int_value: 1 "
 
569
    "      } "
 
570
    "    } "
 
571
    "  } "
 
572
    "}");
 
573
}
 
574
 
537
575
// ===================================================================
538
576
 
539
577
typedef ParserTest ParseServiceTest;