Package com.eclipsesource.jshint

Examples of com.eclipsesource.jshint.Text


    }
    return jshint;
  }

  private void check( IFile file ) throws CoreException {
    Text code = readContent( file );
    ProblemHandler handler = new MarkerHandler( new MarkerAdapter( file ), code );
    try {
      checker.check( code, handler );
    } catch( CoreExceptionWrapper wrapper ) {
      throw (CoreException)wrapper.getCause();
View Full Code Here


  }

  private static Text readContent( InputStream inputStream, String charset )
      throws UnsupportedEncodingException, IOException
  {
    Text result;
    BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream, charset ) );
    try {
      result = new Text( reader );
    } finally {
      reader.close();
    }
    return result;
  }
View Full Code Here

    prefs.save();
  }

  @Test
  public void handleProblem_createsWarning() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockWarning( 1, 2, "foo" ) );

    verify( adapter ).createWarning( 1, 2, 2, "foo" );
  }
View Full Code Here

    verify( adapter ).createWarning( 1, 2, 2, "foo" );
  }

  @Test
  public void handleProblem_createsWarningForError() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockError( 1, 2, "foo" ) );

    verify( adapter ).createWarning( 1, 2, 2, "foo" );
  }
View Full Code Here

  @Test
  public void handleProblem_createsError_ifEnabled() throws CoreException {
    JSHintPreferences prefs = new JSHintPreferences();
    prefs.setEnableErrorMarkers( true );
    prefs.save();
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockError( 1, 2, "foo" ) );

    verify( adapter ).createError( 1, 2, 2, "foo" );
  }
View Full Code Here

    verify( adapter ).createError( 1, 2, 2, "foo" );
  }

  @Test
  public void handleProblem_createsProblemAtDocumentWhenLineIsZero() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockWarning( 0, 1, "test" ) );

    verify( adapter ).createWarning( -1, -1, -1, "test" );
  }
View Full Code Here

    verify( adapter ).createWarning( -1, -1, -1, "test" );
  }

  @Test
  public void handleProblem_createsProblemAtDocumentWhenLineIsNegative() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockWarning( -1, 1, "test" ) );

    verify( adapter ).createWarning( -1, -1, -1, "test" );
  }
View Full Code Here

    verify( adapter ).createWarning( -1, -1, -1, "test" );
  }

  @Test
  public void handleProblem_createsProblemAtDocumentWhenLineExceedsDocument() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockWarning( 2, 1, "test" ) );

    verify( adapter ).createWarning( -1, -1, -1, "test" );
  }
View Full Code Here

    verify( adapter ).createWarning( -1, -1, -1, "test" );
  }

  @Test
  public void handleProblem_createsProblemAtLineWhenCharacterIsNegative() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "test" ) );

    handler.handleProblem( mockWarning( 1, -1, "test" ) );

    verify( adapter ).createWarning( 1, -1, -1, "test" );
  }
View Full Code Here

    verify( adapter ).createWarning( 1, -1, -1, "test" );
  }

  @Test
  public void handleProblem_createsProblemAtLineWhenCharacterExceedsLine() throws CoreException {
    MarkerHandler handler = new MarkerHandler( adapter, new Text( "line1\nline2\n" ) );

    handler.handleProblem( mockWarning( 1, 6, "test" ) );

    verify( adapter ).createWarning( 1, -1, -1, "test" );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.jshint.Text

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.