Package st.gravel.support.compiler.testtools

Examples of st.gravel.support.compiler.testtools.ClassBuilder


  @Test
  public void testIfTrue3() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfTrue3").method(
        "foo: bar ^bar ifTrue: [1]").build();

    Object fooObject = stClass.newInstance();
    Method method = fooObject.getClass().getMethod("foo_", Object.class);
    assertEquals(Integer.valueOf(1), method.invoke(fooObject, true));
View Full Code Here


  @Test
  public void testIfFalse1() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfFalse1").method(
        "foo: bar\n" +
        "  bar ifFalse:  [^1].\n" +
        "  ^2").build();

    Object fooObject = stClass.newInstance();
View Full Code Here

  @Test
  public void testIfFalse2() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfFalse2").method(
        "foo: bar\n" +
        "  |t| t := 2.\n" +
        "  bar ifFalse:  [t := 1].\n" +
        "  ^t").build();
View Full Code Here

  @Test
  public void testIfFalse3() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfFalse3").method(
        "foo: bar\n" +
        "  ^bar ifFalse: [1]").build();

    Object fooObject = stClass.newInstance();
    Method method = fooObject.getClass().getMethod("foo_", Object.class);
View Full Code Here

  @Test
  public void testIfTrueIfFalse1() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfTrueIfFalse1").method(
        "foo: bar\n" +
        "  bar ifTrue: [^1] ifFalse: [^2]").build();

    Object fooObject = stClass.newInstance();
    Method method = fooObject.getClass().getMethod("foo_", Object.class);
View Full Code Here

  @Test
  public void testIfTrueIfFalse2() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfTrueIfFalse2").method(
        "foo: bar\n" +
        "  |res|\n" +
        "  res := bar ifTrue: [1] ifFalse: [2].\n" +
        "  ^res").build();
View Full Code Here

  @Test
  public void testIfTrueIfFalse3() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfTrueIfFalse3").method(
        "foo: bar\n" +
        "  |res|\n" +
        "  bar ifTrue: [res := 1] ifFalse: [res := 2].\n" +
        "  ^res").build();
View Full Code Here

  @Test
  public void testIfTrueIfFalse_withSameTempNames() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testIfTrueIfFalse_withSameTempNames").method(
        "foo: bar\n" +
        "  |res|\n" +
        "  bar ifTrue: [|tmp| tmp := 1. res := tmp] ifFalse: [|tmp| tmp := 2. res := tmp].\n" +
        "  ^res").build();
View Full Code Here

  }

  @Test
  public void test_asOrderedCollection() throws Throwable {

    Class stClass = new ClassBuilder("FooObject_test_asOrderedCollection")
        .method("array" +
        "  ^#(1 2 3)")
        .method("foo" +
            "  ^#(1 2 3) asOrderedCollection")
        .build();
View Full Code Here

  }

  @Test
  public void test_Array_size() throws Throwable {

    Class stClass = new ClassBuilder("FooObject_test_Array_size")
        .method("array" +
        "  ^#(1 2 3)")
        .build();

    Object fooObject = stClass.newInstance();
View Full Code Here

TOP

Related Classes of st.gravel.support.compiler.testtools.ClassBuilder

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.