コード例 #1
0
ファイル: java_test.py プロジェクト: zhangheyu518/clgen
def test_Compile_WrapMethodInClass_hello_world():
    """Test output of wrapping a method in a class."""
    assert java.Compile(
        java.WrapMethodInClass("""\
private static void Hello() {
  System.out.println("Hello, world!");
}""")) == """\
コード例 #2
0
ファイル: java_test.py プロジェクト: 50417/DeepFuzzSL
def test_Compile_WrapMethodInClass_undefined_symbol():
  """Test that error is raised if method has undefined symbols."""
  with pytest.raises(errors.BadCodeException):
    java.Compile(java.WrapMethodInClass("""
private static void Hello() {
  UndefinedMethod(5);
}
"""))
コード例 #3
0
ファイル: java_test.py プロジェクト: 50417/DeepFuzzSL
def test_Compile_hello_world():
  """Test compilation of a "hello world" Java program."""
  assert java.Compile("""
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World");
  }
}
""") == """
コード例 #4
0
ファイル: java_test.py プロジェクト: 50417/DeepFuzzSL
def test_Compile_class_name_whitespace():
  """Test that compile can infer the class name despite whitespace."""
  assert java.Compile("""
public
class     HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World");
  }
}
""") == """
コード例 #5
0
ファイル: java_test.py プロジェクト: 50417/DeepFuzzSL
def test_Compile_InsertShimImports_WrapMethodInClass_array_list():
  """Test output of wrapping a method in a class."""
  assert """\
private static void Hello() {
  ArrayList<Object> a = new ArrayList<>();
  System.out.println("Hello, world!");
}
""" in java.Compile(java.InsertShimImports(java.WrapMethodInClass("""\
private static void Hello() {
  ArrayList<Object> a = new ArrayList<>();
  System.out.println("Hello, world!");
}
""")))
コード例 #6
0
ファイル: java_test.py プロジェクト: 50417/DeepFuzzSL
def test_Compile_empty_input():
  """That an empty file is rejected."""
  with pytest.raises(errors.BadCodeException):
    java.Compile('')
コード例 #7
0
ファイル: java_test.py プロジェクト: 50417/DeepFuzzSL
def test_Compile_WrapMethodInClass_syntax_error():
  """Test that error is raised if method contains a syntax error."""
  with pytest.raises(errors.BadCodeException):
    java.Compile(java.WrapMethodInClass("!@///"))