Package com.eclipsesource.json

Examples of com.eclipsesource.json.JsonObject


      String json = getWorkspaceConfigJson();
      return JsonObject.readFrom( filterComments( json ) );
    } catch( Exception exception ) {
      String message = "Failed to read jshint configuration from workspace preferences";
      Activator.logError( message, exception );
      return new JsonObject();
    }
  }
View Full Code Here


    assertEquals( "", getAllProblems() );
  }

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

    jsHint.check( "foo = {};", handler );

    assertEquals( "1.0:'foo' is not defined", getAllProblems() );
  }
View Full Code Here

    assertEquals( "1.0:'foo' is not defined", getAllProblems() );
  }

  @Test
  public void undefinedVariable_withPredefInConfig_succeeds() {
    JsonObject globals = new JsonObject().add( "foo", true );
    jsHint.configure( new JsonObject().add( "undef", true ).add( "globals", globals ) );

    jsHint.check( "foo = {};", handler );

    assertEquals( "", getAllProblems() );
  }
View Full Code Here

    assertEquals( "", getAllProblems() );
  }

  @Test
  public void undefinedVariable_withReadOnlyPredefInConfig_fails() {
    JsonObject globals = new JsonObject().add( "foo", false );
    jsHint.configure( new JsonObject().add( "undef", true ).add( "globals", globals ) );

    jsHint.check( "foo = {};", handler );

    assertEquals( "1.0:Read only", getAllProblems() );
  }
View Full Code Here

    assertEquals( "1.11:Use '===' to compare with 'null'", getAllProblems() );
  }

  @Test
  public void eqnull_withEmptyConfig() {
    jsHint.configure( new JsonObject() );

    jsHint.check( "var x = 23 == null;", handler );

    assertEquals( "1.11:Use '===' to compare with 'null'", getAllProblems() );
  }
View Full Code Here

    assertEquals( "1.11:Use '===' to compare with 'null'", getAllProblems() );
  }

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

    jsHint.check( "var f = x == null ? null : x + 1;", handler );

    assertEquals( "", getAllProblems() );
  }
View Full Code Here

    assertEquals( "", getAllProblems() );
  }

  @Test
  public void extraComma() {
    JsonObject config = new JsonObject();
    if( versionGreaterThan( "2.0.0" ) ) {
      config.add( "es3", true );
    }
    jsHint.configure( config );

    jsHint.check( "var o = { x: 1, y: 2, z: 3, };", handler );
View Full Code Here

    assertEquals( "1.11", getPositionFromProblem( 0 ) );
  }

  @Test
  public void positionIsCorrectWithLeadingSpace() {
    jsHint.configure( new JsonObject().add( "white", false ) );
    jsHint.check( " var x = 23 == null;", handler );

    assertEquals( "1.12", getPositionFromProblem( 0 ) );
  }
View Full Code Here

    assertEquals( "1.12", getPositionFromProblem( 0 ) );
  }

  @Test
  public void positionIsCorrectWithLeadingTab() {
    jsHint.configure( new JsonObject().add( "white", false ) );
    jsHint.check( "\tvar x = 23 == null;", handler );

    assertEquals( "1.12", getPositionFromProblem( 0 ) );
  }
View Full Code Here

    assertEquals( "1.12", getPositionFromProblem( 0 ) );
  }

  @Test
  public void positionIsCorrectWithMultipleTabs() {
    jsHint.configure( new JsonObject().add( "white", false ) );
    jsHint.check( "\tvar x\t= 23 == null;", handler );

    assertEquals( "1.12", getPositionFromProblem( 0 ) );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.json.JsonObject

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.