Exemple #1
0
def test_JavaMethods_simple_file():
  """Test output of simple class file."""
  assert (
    extractors.JavaMethods(
      None,
      None,
      """
public class A {

  public static void main(String[] args) {
    System.out.println("Hello, world!");
  }

  private int foo() { /* comment */ return 5; }
}
""",
      None,
    )
    == [
      """\
public static void main(String[] args){
  System.out.println("Hello, world!");
}
""",
      """\
private int foo(){
  return 5;
}
""",
    ]
  )
Exemple #2
0
def test_JavaMethods_syntax_error():
    """Test that syntax errors are silently ignored."""
    assert extractors.JavaMethods(
        None, None, """
public class A {

  public static void main(String[] args) {
    /@! syntax error!
  }
}
""", None) == ["public static void main(String[] args){\n}\n"]
Exemple #3
0
def test_JavaMethods_hello_world():
    """Test that no methods in "hello world"."""
    assert extractors.JavaMethods(None, None, "Hello, world!", None) == []