Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.FieldOption


  //
  // message Person {
  //   optional boolean active = 1 [default = true, deprecated = false];
  // }
  @Test public void should_return_true_if_FieldOption_is_default_value_one() {
    FieldOption option = xtext.find("default", FieldOption.class);
    assertTrue(options.isDefaultValueOption(option));
  }
View Full Code Here


  //
  // message Person {
  //   optional boolean active = 1 [default = true, deprecated = false];
  // }
  @Test public void should_return_false_if_FieldOption_is_not_default_value_one() {
    FieldOption option = xtext.find("deprecated", FieldOption.class);
    assertFalse(options.isDefaultValueOption(option));
  }
View Full Code Here

  //
  // message Person {
  //   optional Type type = 1 [default = ONE];
  // }
  @Test public void should_provide_Literals_for_default_value() {
    FieldOption option = xtext.find("default", FieldOption.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum typeEnum = xtext.find("Type", " {", Enum.class);
    assertThat(descriptionsIn(scope), containAllLiteralsIn(typeEnum));
  }
View Full Code Here

  //
  //  message Person {
  //    optional Type type = 1 [ctype = STRING];
  //  }
  @Test public void should_provide_Literals_for_source_of_native_field_option() {
    FieldOption option = xtext.find("ctype", FieldOption.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Enum cTypeEnum = descriptor.enumByName("CType");
    assertThat(descriptionsIn(scope), containAllLiteralsIn(cTypeEnum));
  }
View Full Code Here

  //
  // message Person {
  //   optional boolean active = 1 [(type) = ONE];
  // }
  @Test public void should_provide_Literals_for_source_of_custom_field_option() {
    FieldOption option = xtext.find("type", ")", FieldOption.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum typeEnum = xtext.find("Type", " {", Enum.class);
    assertThat(descriptionsIn(scope), containAllLiteralsIn(typeEnum));
  }
View Full Code Here

  //
  // message Person {
  //   optional boolean active = 1 [(info).type = ONE];
  // }
  @Test public void should_provide_Literals_for_source_of_field_in_custom_field_option() {
    FieldOption option = xtext.find("info", ")", FieldOption.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum typeEnum = xtext.find("Type", " {", Enum.class);
    assertThat(descriptionsIn(scope), containAllLiteralsIn(typeEnum));
  }
View Full Code Here

            if (nodes.isCommentOrString(c.getCurrentNode())) {
              continue;
            }
            EObject model = modelFrom(c);
            if (model instanceof FieldOption) {
              FieldOption option = (FieldOption) model;
              model = option.eContainer();
            }
            if (model instanceof Literal) {
              Literal literal = (Literal) model;
              if (shouldCalculateIndex(literal, LITERAL__INDEX)) {
                long index = literals.calculateNewIndexOf(literal);
View Full Code Here

  //
  // message Person {
  //   optional boolean active = 1 [deprecated = false];
  // }
  @Test public void should_return_name_of_native_field_option() {
    FieldOption option = xtext.find("deprecated", FieldOption.class);
    String name = options.nameOf(option);
    assertThat(name, equalTo("deprecated"));
  }
View Full Code Here

  //
  // message Person {
  //   optional boolean active = 1 [(encoding) = 'UTF-8'];
  // }
  @Test public void should_return_name_of_custom_field_option() {
    FieldOption option = xtext.find("encoding", ")", FieldOption.class);
    String name = options.nameOf(option);
    assertThat(name, equalTo("encoding"));
  }
View Full Code Here

  //
  // message Person {
  //   optional boolean active = 1 [deprecated = false];
  // }
  @Test public void should_return_field_of_native_field_option() {
    FieldOption option = xtext.find("deprecated", FieldOption.class);
    MessageField field = (MessageField) options.rootSourceOf(option);
    assertThat(field.getName(), equalTo("deprecated"));
  }
View Full Code Here

TOP

Related Classes of com.google.eclipse.protobuf.protobuf.FieldOption

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.