Examples of ClassBuilder


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

  @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

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

  @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

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

  @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

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

  @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

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

  @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

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

  @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

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

  @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

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

  }

  @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

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

  }

  @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

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

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

    Class stClass = new ClassBuilder("FooObject_testArrayAdd")
        .method("foo | coll |" +
            "  ^#(1 2 3) collect: [:each | each + 4]")
        .build();

    Object fooObject = stClass.newInstance();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.