Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3815 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
60 changed files with 467 additions and 323 deletions
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using IronPython.Compiler.Ast; |
||||
using NUnit.Framework; |
||||
using PythonBinding.Tests; |
||||
|
||||
namespace PythonBinding.Tests.Parsing |
||||
{ |
||||
/// <summary>
|
||||
/// The IronPython parser will throw an invalid cast exception for the following code:
|
||||
///
|
||||
/// class Project(id):
|
||||
/// def __init__ Project_ID():
|
||||
/// #i
|
||||
///
|
||||
/// System.InvalidCastException: Unable to cast object of type 'IronPython.Compiler.Ast.ErrorExpression' to type 'IronPython.Compiler.Ast.NameExpression'.
|
||||
/// at IronPython.Compiler.Parser.ParseParameter(Int32 position, Dictionary`2 names)
|
||||
/// at IronPython.Compiler.Parser.ParseVarArgsList(TokenKind terminator)
|
||||
/// at IronPython.Compiler.Parser.ParseFuncDef()
|
||||
/// at IronPython.Compiler.Parser.ParseStmt()
|
||||
/// at IronPython.Compiler.Parser.ParseSuite()
|
||||
/// at IronPython.Compiler.Parser.ParseClassDef()
|
||||
/// at IronPython.Compiler.Parser.ParseStmt()
|
||||
/// at IronPython.Compiler.Parser.ParseFile(Boolean makeModule)
|
||||
/// at ICSharpCode.PythonBinding.PythonParser.CreateAst(String fileName, String fileContent)
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class InvalidCastInPythonParserTestFixture |
||||
{ |
||||
string code = "class Project(id): \r\n" + |
||||
" def __init__ Project_ID(): \r\n" + |
||||
" #i\r\n"; |
||||
|
||||
/// <summary>
|
||||
/// Check that IronPython bug still exists.
|
||||
/// </summary>
|
||||
[Test] |
||||
[ExpectedException(typeof(InvalidCastException))] |
||||
public void CreateAstShouldThrowInvalidCastException() |
||||
{ |
||||
PythonParser parser = new PythonParser(); |
||||
PythonAst ast = parser.CreateAst(@"d:\projects\test\test.py", code); |
||||
} |
||||
|
||||
[Test] |
||||
public void ParseShouldNotThrowInvalidCastException() |
||||
{ |
||||
PythonParser parser = new PythonParser(); |
||||
ICompilationUnit unit = parser.Parse(new DefaultProjectContent(), @"d:\projects\test\test.py", code); |
||||
Assert.AreEqual(0, unit.Classes.Count); |
||||
} |
||||
} |
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
<AddIn name = "Dynamic help pad for SharpDevelop" |
||||
author = "Mathias Simmack" |
||||
description = "integrates Microsoft's Help 2.0 Environment"> |
||||
|
||||
<Manifest> |
||||
<Identity name = "ICSharpCode.HtmlHelp2.DynamicHelpPad"/> |
||||
</Manifest> |
||||
|
||||
<Runtime> |
||||
<Import assembly="HtmlHelp2.dll"/> |
||||
</Runtime> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/Pads"> |
||||
<Pad id = "DynamicHelpPad" |
||||
category = "Help2" |
||||
title = "${res:AddIns.HtmlHelp2.DynamicHelp}" |
||||
icon = "HtmlHelp2.16x16.DynamicHelp" |
||||
class = "HtmlHelp2.HtmlHelp2DynamicHelpPad" |
||||
defaultPosition = "Right, Hidden" /> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/MainMenu/Help"> |
||||
<MenuItem id = "DynamicHelpPadCommand" |
||||
insertbefore = "TocPadCommand" |
||||
label = "${res:AddIns.HtmlHelp2.DynamicHelp}" |
||||
icon = "HtmlHelp2.16x16.DynamicHelp" |
||||
shortcut = "Control|F1" |
||||
class = "HtmlHelp2.ShowDynamicHelpMenuCommand"/> |
||||
</Path> |
||||
</AddIn> |
Loading…
Reference in new issue