• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CompileTester类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.testing.compile.CompileTester的典型用法代码示例。如果您正苦于以下问题:Java CompileTester类的具体用法?Java CompileTester怎么用?Java CompileTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CompileTester类属于com.google.testing.compile包,在下文中一共展示了CompileTester类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doTest

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
private void doTest() throws Exception {
    LOG.info("Running test '{}' for parser '{}'", caseName, parserName);

    List<JavaFileObject> inputs = subFileObjetcs(inputPath);
    LOG.debug("Using inputs {}", inputs);

    List<String> options = parseOptions();
    LOG.debug("Using options {}", options);

    CompileTester.SuccessfulCompilationClause clause = Truth.assert_()
            .about(JavaSourcesSubjectFactory.javaSources())
            .that(subFileObjetcs(inputPath))
            .withCompilerOptions(options)
            .processedWith(new OpenAPIProcessor())
            .compilesWithoutError();

    resources(expectedPath)
            .stream()
            .peek(resource -> LOG.debug("Validating expectation on {}", resource))
            .forEach(resource -> clause.and()
                    .generatesFileNamed(LOCATION, resource.packageName, resource.relativeName)
                    .withContents(resource.byteSource));
}
 
开发者ID:Cosium,项目名称:openapi-annotation-processor,代码行数:24,代码来源:ParserCaseTester.java


示例2: testLibNotOnClass

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testLibNotOnClass() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public interface Testing {\n" + // <----
                                                                      "    long doStaticTest(long tst,\n" +
                                                                      "                      byte field0,\n" +
                                                                      "                      @Unsigned short field1,\n" +
                                                                      "                      @Ptr(int.class) long field2,\n" +
                                                                      "                      @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Lib annotation should be placed on class type only.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedLibTest.java


示例3: testPtrAnnotationNotOnPrimitiveLong

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testPtrAnnotationNotOnPrimitiveLong() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public class Testing {\n" +
                                                                      "    public static native long doStaticTest(long tst,\n" +
                                                                      "                                           byte field0,\n" +
                                                                      "                                           @Unsigned short field1,\n" +
                                                                      "                                           @Ptr(int.class) int field2,\n" + // <----
                                                                      "                                           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Ptr annotation can only be placed on primitive type 'long'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedLibTest.java


示例4: testUnsignedAnnotationNotOnPrimitiveNonFloat

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testUnsignedAnnotationNotOnPrimitiveNonFloat() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public class Testing {\n" +
                                                                      "    public static native long doStaticTest(long tst,\n" +
                                                                      "                                           byte field0,\n" +
                                                                      "                                           @Unsigned short field1,\n" +
                                                                      "                                           @Unsigned float field2,\n" + // <----
                                                                      "                                           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Unsigned annotation can not be placed on primitive type 'float'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedLibTest.java


示例5: testUnsignedAnnotationNotOnPrimitiveNonDouble

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testUnsignedAnnotationNotOnPrimitiveNonDouble() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public class Testing {\n" +
                                                                      "    public static native long doStaticTest(long tst,\n" +
                                                                      "                                           byte field0,\n" +
                                                                      "                                           @Unsigned short field1,\n" +
                                                                      "                                           @Unsigned double field2,\n" +// <----
                                                                      "                                           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Unsigned annotation can not be placed on primitive type 'double'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedLibTest.java


示例6: testUnsignedAnnotationInConjunctionWithPtrAnnotation

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testUnsignedAnnotationInConjunctionWithPtrAnnotation() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public class Testing {\n" +
                                                                      "    public static native long doStaticTest(long tst,\n" +
                                                                      "                                           byte field0,\n" +
                                                                      "                                           @Unsigned short field1,\n" +
                                                                      "                                           @Unsigned @Ptr(long.class) long field2,\n" + // <----
                                                                      "                                           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Unsigned annotation can not be placed in conjunction with @Ptr annotation.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedLibTest.java


示例7: testSymbolAnnotationNotAPtr

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testSymbolAnnotationNotAPtr(){
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Symbol;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public class Testing {\n" +
                                                                      "    @Symbol\n" +
                                                                      "    public static native long globalVariable();\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("Symbol should be annotated with @Ptr.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:23,代码来源:CheckWellFormedLibTest.java


示例8: testStructNoFields

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testStructNoFields() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("org.freedesktop.libtest.struct.TestStruct",
                                                                      "package org.freedesktop.jaccall.compiletime.linker;\n" +
                                                                      "\n" +
                                                                      "import org.freedesktop.jaccall.Struct;\n" +
                                                                      "\n" +
                                                                      "@Struct(value = {})\n" +
                                                                      "public final class TestStruct extends TestStruct_Jaccall_StructType {\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Struct annotation must have at least one field.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:21,代码来源:CheckWellFormedStructTest.java


示例9: testNotAnInterface

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testNotAnInterface() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Functor;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Functor\n" +
                                                                      "public abstract class Testing {\n" +
                                                                      "    abstract long $(long tst,\n" +
                                                                      "                    byte field0,\n" +
                                                                      "                    @Unsigned short field1,\n" +
                                                                      "                    @Ptr(int.class) long field2,\n" +
                                                                      "                    @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("Type must be an interface.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedFunctorTest.java


示例10: testNotDollarAsName

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testNotDollarAsName() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Functor;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Functor\n" +
                                                                      "public interface Testing {\n" +
                                                                      "    long doStaticTest(long tst,\n" +
                                                                      "                      byte field0,\n" +
                                                                      "                      @Unsigned short field1,\n" +
                                                                      "                      @Ptr(int.class) long field2,\n" +
                                                                      "                      @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("Method name must be 'invoke'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedFunctorTest.java


示例11: testPtrAnnotationNotOnPrimitiveLong

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testPtrAnnotationNotOnPrimitiveLong() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Functor;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Functor\n" +
                                                                      "public interface Testing {\n" +
                                                                      "    long $(long tst,\n" +
                                                                      "           byte field0,\n" +
                                                                      "           @Unsigned short field1,\n" +
                                                                      "           @Ptr(int.class) int field2,\n" + // <----
                                                                      "           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Ptr annotation can only be placed on primitive type 'long'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedFunctorTest.java


示例12: testUnsignedAnnotationNotOnPrimitiveNonFloat

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testUnsignedAnnotationNotOnPrimitiveNonFloat() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Functor;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Functor\n" +
                                                                      "public interface Testing {\n" +
                                                                      "    long $(long tst,\n" +
                                                                      "           byte field0,\n" +
                                                                      "           @Unsigned short field1,\n" +
                                                                      "           @Unsigned float field2,\n" + // <----
                                                                      "           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Unsigned annotation can not be placed on primitive type 'float'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedFunctorTest.java


示例13: testUnsignedAnnotationNotOnPrimitiveNonDouble

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testUnsignedAnnotationNotOnPrimitiveNonDouble() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Functor;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Functor\n" +
                                                                      "public interface Testing {\n" +
                                                                      "    long $(long tst,\n" +
                                                                      "           byte field0,\n" +
                                                                      "           @Unsigned short field1,\n" +
                                                                      "           @Unsigned double field2,\n" +// <----
                                                                      "           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Unsigned annotation can not be placed on primitive type 'double'.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedFunctorTest.java


示例14: testUnsignedAnnotationInConjunctionWithPtrAnnotation

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testUnsignedAnnotationInConjunctionWithPtrAnnotation() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Functor;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Functor\n" +
                                                                      "public interface Testing {\n" +
                                                                      "    long $(long tst,\n" +
                                                                      "           byte field0,\n" +
                                                                      "           @Unsigned short field1,\n" +
                                                                      "           @Unsigned @Ptr(long.class) long field2,\n" + // <----
                                                                      "           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Unsigned annotation can not be placed in conjunction with @Ptr annotation.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:27,代码来源:CheckWellFormedFunctorTest.java


示例15: testM1_NRelatedToOneAP_creates_GeneratedFiles_WhenSingleFileToProcess_UsesPreviouslyCompiledClass

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testM1_NRelatedToOneAP_creates_GeneratedFiles_WhenSingleFileToProcess_UsesPreviouslyCompiledClass() {
  //GIVEN
  JavaFileObject source = forSourceString("test.Test", "" //
      + "package test;\n" //
      + "import org.gradle.incap.Annotation1;\n" //
      + "@Annotation1\n" //
      + "public class Test extends org.gradle.incap.util.Untouched{\n" //
      + "}");
  JavaFileObject expected0 = forSourceString("M1_NRelatedToOneAP_TestGen0", "" //
      + "\n" //
      + "public class M1_NRelatedToOneAP_TestGen0 {\n" //
      + "}");

  //WHEN
  //THEN
  CompileTester.SuccessfulCompilationClause successfulCompilationClause = Truth.assertAbout(JavaSourceSubjectFactory.javaSource()).that(source) //
      .withCompilerOptions("-Xlint:-processing","-Aincap.mapping.folder=.") //
      .processedWith(new M1_NRelatedToOneAP()) //
      .compilesWithoutError().and().generatesSources(expected0);

  try {
    successfulCompilationClause //
        .and() //
        .generatesFileNamed(StandardLocation.SOURCE_OUTPUT, "", "M1_NRelatedToOneAP_UntouchedGen0");
    fail();
  } catch (AssertionError e) {
  }
}
 
开发者ID:gradle,项目名称:incap,代码行数:30,代码来源:M1_NRelatedToOneAPTest.java


示例16: forSourceString

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testM1_OneToOneAP_incremental_creates_GeneratedFile_WhenSingleFileToProcess_UsesPreviouslyCompiledClass() {
  //GIVEN
  source = forSourceString("test.Test", "" //
      + "package test;\n" //
      + "import org.gradle.incap.Annotation1;\n" //
      + "@Annotation1\n" //
      + "public class Test extends org.gradle.incap.util.Untouched {\n" //
      + "}");
  expected = forSourceString("M1_OneToOneAP_TestGen0", "" //
      + "\n" //
      + "public class M1_OneToOneAP_TestGen0 {\n" //
      + "}");

  //WHEN
  //THEN
  CompileTester.SuccessfulCompilationClause successfulCompilationClause = Truth.assertAbout(JavaSourceSubjectFactory.javaSource()) //
      .that(source) //
      .withCompilerOptions("-Xlint:-processing","-Aincap.mapping.folder=.") //
      .withClasspathFrom(getClass().getClassLoader()) //
      .processedWith(new M1_OneToOneAP()) //
      .compilesWithoutError() //
      .and() //
      .generatesSources(expected);

  try {
    successfulCompilationClause //
        .and() //
        .generatesFileNamed(StandardLocation.SOURCE_OUTPUT, "", "M1_OneToOneAP_UntouchedGen0");
    fail();
  } catch (AssertionError e) {
  }
}
 
开发者ID:gradle,项目名称:incap,代码行数:34,代码来源:M1_OneToOneAPTest.java


示例17: testLibOnNestedClass

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testLibOnNestedClass() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("org.freedesktop.libtest.UpperTesting",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "public class UpperTesting {" +
                                                                      "   @Lib(\"testing\")\n" +
                                                                      "   public static class Testing {\n" +
                                                                      "       public static native long doStaticTest(long tst,\n" +
                                                                      "                                              byte field0,\n" +
                                                                      "                                              @Unsigned short field1,\n" +
                                                                      "                                              @Ptr(int.class) long field2,\n" +
                                                                      "                                              @Ptr(int.class) long field3);\n" +
                                                                      "   }" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("@Lib annotation should be placed on top level class types only.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:29,代码来源:CheckWellFormedLibTest.java


示例18: testNotAPrimitive

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testNotAPrimitive() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.freedesktop.jaccall.Unsigned;\n" +
                                                                      "\n" +
                                                                      "@Lib(\"testing\")\n" +
                                                                      "public class Testing {\n" +
                                                                      "    public static native " +
                                                                      "                         Long doStaticTest(" + // <----
                                                                      "                                           long tst,\n" +
                                                                      "                                           byte field0,\n" +
                                                                      "                                           @Unsigned short field1,\n" +
                                                                      "                                           @Ptr(int.class) long field2,\n" +
                                                                      "                                           @Ptr(int.class) long field3);\n" +
                                                                      "}");
    //when
    final CompileTester compileTester = assert_().about(javaSource())
                                                 .that(fileObject)
                                                 .processedWith(new JaccallGenerator());
    //then
    compileTester.failsToCompile()
                 .withErrorContaining("Method should have supported primitive types only.")
                 .in(fileObject);
}
 
开发者ID:udevbe,项目名称:jaccall,代码行数:29,代码来源:CheckWellFormedLibTest.java


示例19: testByValAnnotationNotOnPrimitiveLong

import com.google.testing.compile.CompileTester; //导入依赖的package包/类
@Test
public void testByValAnnotationNotOnPrimitiveLong() {
    //given
    final JavaFileObject fileObject = JavaFileObjects.forSourceString("Testing",
                                                                      "package org.freedesktop.libtest;\n" +
                                                                      "import org.freedesktop.jaccall.Lib;\n" +
                                                                      "import org.freedesktop.jaccall.ByVal;\n" +
                                                                      "import org.freedesktop.jaccall.StructType;\n" +
                                                                      "import org.freedesktop.jaccall.Ptr;\n" +
                                                                      "import org.free 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamDataBodyPart类代码示例发布时间:2022-05-22
下一篇:
Java Message类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap