package magic.core;

import static org.junit.Assert.*;

import org.junit.Test;

import magic.Core;

public class TestEdgeCases {
	@SuppressWarnings("unchecked")
	private <T> T exec(String code) {
		return (T) Core.eval(code).getValue();
	}
	
	@Test public void testDefUnquote() {
		// unquote should create a symbol that can be used with def
		assertEquals((Long)2L,exec("(def ~'a 2) a"));
		assertEquals((Long)2L,exec("(def ~(symbol \"a\") 2) a"));
	}
}

@@ -446,10 +446,187 @@
 %22));%0A%09%7D%0A
+%09%0A%09@Test public void testArgUnquote() %7B%0A%09%09// unquote should create a symbol that can be used in arg vector%0A%09%09assertEquals((Long)3L,exec(%22(defn foo %5B~'a%5D (+ 2 a)) (foo 1)%22));%0A%09%7D%0A
 %7D%0A

Test for unquote in parameter vector