/** * Copyright (c) 2005-2008 Aptana, Inc. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Aptana Public License v1.0 * which accompanies this distribution, and is available at * http://www.aptana.com/legal/apl/. * * Redistribution, except as permitted by the above license, is prohibited. * Any modifications to this file must keep this entire header intact. */ package com.aptana.ide.editor.js.tests.model; import com.aptana.ide.editor.js.runtime.IObject; import com.aptana.ide.editor.js.runtime.JSFunction; import com.aptana.ide.editor.js.runtime.JSFunctionConstructor; import com.aptana.ide.editor.js.runtime.JSNumber; /** * @author Kevin Lindsey */ public class TestFunctionConstructor extends TestModelBase { private static final String TARGET = "Function"; /** * testExists */ public void testExists() { IObject object = this.getGlobalProperty(TARGET); assertNotNull(object); } /** * testClassName */ public void testClassName() { IObject object = this.getGlobalProperty(TARGET); String name = object.getClassName(); assertEquals("Function", name); } /** * testLength */ public void testLength() { this.testType(this.getGlobalProperty(TARGET), "length", JSNumber.class); } /** * testPrivatePrototype */ public void testPrivatePrototype() { IObject privatePrototype = this.getPrivatePrototype(TARGET); IObject functionPrototype = this.getPublicPrototype("Function"); assertSame(functionPrototype, privatePrototype); } /** * testConstructor */ public void testConstructor() { this.testType(this.getPublicPrototype(TARGET), "constructor", JSFunctionConstructor.class); } /** * testToString */ public void testToString() { this.testType(this.getPublicPrototype(TARGET), "toString", JSFunction.class); } /** * testApply */ public void testApply() { this.testType(this.getPublicPrototype(TARGET), "apply", JSFunction.class); } /** * testCall */ public void testCall() { this.testType(this.getPublicPrototype(TARGET), "call", JSFunction.class); } }