package net.zero918nobita.Xemime;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;

/**
 * net.zero918nobita.Xemime.X_Symbol のテストクラスです。
 * @author Kodai Matsumoto
 */

public class X_SymbolTest {
    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    @Test
    public void testRun() throws Exception {
        expectedException.expect(Exception.class);
        expectedException.expectMessage("シンボル `unknown` は定義されていません");
        X_Symbol symbol = X_Symbol.intern("unknown");
        symbol.run();
    }

    @Test
    public void testRun2() throws Exception {
        Main.defValue(X_Symbol.intern("variable"), new X_Symbol("value"));
        X_Symbol symbol = X_Symbol.intern("variable");
        assertThat(symbol.run().toString(), is("value"));
    }

    @Test
    public void testToString() {
        X_Symbol symbol = X_Symbol.intern("sample");
        assertThat(symbol.toString(), is("sample"));
    }
}

@@ -160,16 +160,59 @@
 rtThat;%0A
+import static org.junit.Assert.assertTrue;%0A
 import s
@@ -446,16 +446,216 @@
 one();%0A%0A
+    @Test%0A    public void testEquals() %7B%0A        X_Symbol a = X_Symbol.intern(%22A%22);%0A        X_Symbol b = X_Symbol.intern(%22A%22);%0A        assertTrue(a.equals(b));%0A        assertTrue(b.equals(a));%0A    %7D%0A%0A
     @Tes
@@ -1310,11 +1310,167 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testGetName() %7B%0A        X_Symbol symbol = X_Symbol.intern(%22sample2%22);%0A        assertThat(symbol.getName(), is(%22sample2%22));%0A    %7D
 %0A%7D%0A

Update X_SymbolTest