Package com.eclipsesource.json

Examples of com.eclipsesource.json.JsonObject$HashIndexTable


  @Test
  public void emptyConfigForProjectsWithoutConfigFileAndProperties() {
    projectPrefs.setProjectSpecific( true );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( new JsonObject(), configuration );
  }
View Full Code Here


  @Test
  public void filtersCommentsFromProjectConfig() {
    projectPrefs.setConfig( "{\n// \"a\": 1,\n\"b\": 2 /*, \"c\": 3*/}" );
    projectPrefs.setProjectSpecific( true );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( new JsonObject().add( "b", 2 ), configuration );
    assertEquals( Arrays.asList( "b" ), configuration.names() );
  }
View Full Code Here

  @Test
  public void filtersCommentsFromWorkspaceConfig() {
    workspacePrefs.setConfig( "{\n// \"a\": 1,\n\"b\": 2 /*, \"c\": 3*/}" );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( new JsonObject().add( "b", 2 ), configuration );
    assertEquals( Arrays.asList( "b" ), configuration.names() );
  }
View Full Code Here

    jsHint.configure( null );
  }

  @Test
  public void configureBeforeLoad() throws Exception {
    JsonObject configuration = new JsonObject().add( "undef", true );

    JSHint jsHint = new JSHint();
    jsHint.configure( configuration );
    jsHint.load();
    jsHint.check( "x = 23;", handler );
View Full Code Here

    assertEquals( "'x' is not defined", problems.get( 0 ).getMessage() );
  }

  @Test
    public void loadBeforeConfigure() throws Exception {
    JsonObject configuration = new JsonObject().add( "undef", true );

    JSHint jsHint = new JSHint();
    jsHint.load();
    jsHint.configure( configuration );
    jsHint.check( "x = 23;", handler );
View Full Code Here

  }

  @Test
  public void noErrorsWithEmptyConfig() {
    // undefined variable is only reported with 'undef' in config
    jsHint.configure( new JsonObject() );

    jsHint.check( "var f = function () { v = {}; };", handler );

    assertTrue( problems.isEmpty() );
  }
View Full Code Here

    assertTrue( problems.isEmpty() );
  }

  @Test
  public void errorWithUndefInConfig() {
    jsHint.configure( new JsonObject().add( "undef", true ) );

    jsHint.check( "var f = function () { v = {}; };", handler );

    assertThat( problems.get( 0 ).getMessage(), containsString( "'v' is not defined" ) );
  }
View Full Code Here

    assertThat( problems.get( 0 ).getMessage(), containsString( "'v' is not defined" ) );
  }

  @Test
  public void errorAfterTabHasSamePositionAsAfterSpace() {
    jsHint.configure( new JsonObject().add( "undef", true ) );
    jsHint.check( "var x = 1, # y = 2;", handler );
    Problem problemWithSpace = problems.get( 0 );
    problems.clear();

    jsHint.check( "var x = 1,\t# y = 2;", handler );
View Full Code Here

    assertEquals( problemWithSpace.getCharacter(), problemWithTab.getCharacter() );
  }

  @Test
  public void errorAtEndDoesNotThrowException() {
    jsHint.configure( new JsonObject().add( "undef", true ) );

    // Must not throw SIOOBE
    // See https://github.com/eclipsesource/jshint-eclipse/issues/34
    jsHint.check( "var x = 1;\t#", handler );
  }
View Full Code Here

    jsHint.check( "var x = 1;\t#", handler );
  }

  @Test
  public void checkSameInputTwice() {
    jsHint.configure( new JsonObject().add( "undef", true ) );
    LoggingHandler handler1 = new LoggingHandler();
    LoggingHandler handler2 = new LoggingHandler();

    jsHint.check( "var x = 1;\t#", handler1 );
    jsHint.check( "var x = 1;\t#", handler2 );
View Full Code Here

TOP

Related Classes of com.eclipsesource.json.JsonObject$HashIndexTable

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.