Package st.gravel.support.compiler

Source Code of st.gravel.support.compiler.StringTest

package st.gravel.support.compiler;

import static org.junit.Assert.assertEquals;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.junit.Before;
import org.junit.Test;

import st.gravel.support.compiler.testtools.ClassBuilder;
import st.gravel.support.compiler.testtools.TestBootstrap;
import st.gravel.support.jvm.runtime.ImageBootstrapper;

public class StringTest {

  @Before
  public void setUp() {
    TestBootstrap.getSingleton();
  }

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

    Class stClass = new ClassBuilder("FooObject_String_equals").
        method("foo: x equals: y ^x=y").
        method("foo ^self foo: 'abc' equals: 'ab','c'").
        build();

    Object fooObject = stClass.newInstance();
    Method method = fooObject.getClass().getMethod("foo");
    assertEquals(Boolean.TRUE, method.invoke(fooObject));
  }

}
TOP

Related Classes of st.gravel.support.compiler.StringTest

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.