Package st.gravel.support.compiler.testtools

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


  public void testFullCopyingBlock() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

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


  public void testReadOuterTemp1() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

    Class stClass = new ClassBuilder(
        "FooObject_testReadOuterTemp1").method(
        "foo: bar\n" + "| a ar aw |\n" + "a := 0.\n"
            + "ar := [a + 7].\n" + "a := bar.  \n" + "^ar value")
        .build();
View Full Code Here

  public void testReadWriteOuterTemp() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

    Class stClass = new ClassBuilder(
        "FooObject_testReadWriteOuterTemp").method(
        "foo: bar\n" + "| a ar aw |\n" + "a := 0.\n" + "ar := [a].\n"
            + "aw := [:x | a := x + 7].\n" + "aw value: bar.  \n"
            + "^ar value").build();
View Full Code Here

  public void testReadWriteOuterTempDoubleNested()
      throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {

    Class stClass = new ClassBuilder(
        "FooObject_testReadWriteOuterTempDoubleNested").method(
        "foo: bar\n" + "| a ar aw |\n" + "a := 0.\n"
            + "ar := [[a] value].\n"
            + "aw := [:x | [:y | a := y + 7] value: x].\n"
            + "aw value: bar.  \n" + "^ar value").build();
View Full Code Here

  public void testNestedReturn() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testNestedReturn")
        .method("foo: bar\n" + "| a ar aw |\n" + "a := 0.\n"
            + "ar := [[^a] value].\n"
            + "aw := [:x | [:y | a := y + 7] value: x].\n"
            + "aw value: bar.  \n" + "^ar value").build();
View Full Code Here

  public void testReadWriteInstVar() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

    Class stClass = new ClassBuilder("FooObject_testReadWriteInstVar")
        .method("foo: bar\n" + "bar name: 'Fromage'.\n" + "^bar name")
        .build();
    Class barClass = new ClassBuilder("BarObject_testReadWriteInstVar")
        .method("name: aString name := aString").method("name ^name")
        .instVar("name").build();

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

  public void testReadWriteInstVarInBlock() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

    Class stClass = new ClassBuilder(
        "FooObject_testReadWriteInstVarInBlock").method(
        "foo: bar\n" + "bar setNameInBlock: 'Fromage'.\n"
            + "^bar readNameInBlock").build();
    Class barClass = new ClassBuilder(
        "BarObject_testReadWriteInstVarInBlock")
        .method("setNameInBlock: anObject\n"
            + "  [name := anObject] value")
        .method("readNameInBlock\n" + "  ^[name] value").instVar("name")
        .build();
View Full Code Here

  public void testReadWriteInstVarInNameBlock() throws NoSuchMethodException,
      SecurityException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException,
      InstantiationException {

    Class stClass = new ClassBuilder(
        "FooObject_testReadWriteInstVarInNameBlock").method(
        "foo: bar\n" + "|bl|\n" + "bl := bar nameBlock.\n"
            + "bar setNameInBlock: 'Fromage'.\n" + "^bl value")
        .build();
    Class barClass = new ClassBuilder(
        "BarObject_testReadWriteInstVarInNameBlock")
        .method("setNameInBlock: anObject\n"
            + "  [name := anObject] value")
        .method("nameBlock\n" + "  ^[name]").instVar("name")
        .build();
View Full Code Here

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

    Class classA = new ClassBuilder("ClassA_testSymbolLiteral")
        .method("foo ^#aap")
        .method("bar ^#aap")
        .build();

    Object classAObj = classA.newInstance();
View Full Code Here

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

    Class classA = new ClassBuilder("ClassA_testByteArrayLiteral")
        .method("foo ^#[0 1 127 128 255 0]")
        .method("bar ^#[0 1 127 128 255 0]")
        .method("eq ^self foo == self bar")
        .build();
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.