mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
CodeParameterDeclarationExpression. * CodeGeneratorFromTypeTest.cs: Modified tests to check result for zero-length event, field and parameter name. * CodeGeneratorFromStatementTest.cs: Added CodeCommentStatement, CodeThrowExceptionStatement, CodeGotoStatement and CodeTryCatchFinallyStatement tests. * CodeGeneratorFromTypeTestBase.cs: Modified GetMethodMembersType3 to add parameter with no name. * CodeGeneratorTestBase.cs: Removed Code property, added Generate overload taking CodeGeneratorOptions, added NewLine property. * CodeGeneratorCompileUnitTest.cs: Use Generate method instead of Code property. * CodeGeneratorFromExpressionTest.cs: Added test for CodeParameterDeclarationExpression. * CodeGeneratorFromTypeTest.cs: Added tests for __exception name that is output for zero-length field, event and parameter name in 2.0 profile. * CodeGeneratorFromStatementTest.cs: Added. * CSharpCodeGenerator.cs: Fixed GenerateComment to also write comment chars for carriage-return (and skip linefeed, if its the next character). Fixed output for TryCatchFinallyStatement. Fixed GotoStatement to end with newline. * VBCodeGenerator.cs: Fixed NullReferenceException if no ToThrow expression is set for CodeThrowExceptionStatement. Fixed GenerateComment to output comment chars for carriage-returns and linefeed characters. Modified code generated for CodeTryCatchFinallyStatement to match MS.NET. Fixed code generated for CodeGotoStatement to match MS.NET. On 2.0 profile, output "__exception" if name is zero-length string in OutputTypeNamePair. svn path=/trunk/mcs/; revision=53506
60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
//
|
|
// Microsoft.VisualBasic.* Test Cases
|
|
//
|
|
// Authors:
|
|
// Jochen Wezel ([email protected])
|
|
//
|
|
// Based on the C# units of
|
|
// Erik LeBel ([email protected])
|
|
//
|
|
// (c) 2003 Jochen Wezel, CompuMaster GmbH
|
|
//
|
|
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.CodeDom;
|
|
using System.CodeDom.Compiler;
|
|
using Microsoft.VisualBasic;
|
|
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoTests.Microsoft.VisualBasic
|
|
{
|
|
///
|
|
/// <summary>
|
|
/// Base test for a variety of CodeGenerator GenerateCodeXXX methods.
|
|
///
|
|
/// This testing is a form of hybrid test, it tests the variety of CodeDom
|
|
/// classes as well as the VB code generator.
|
|
///
|
|
/// The implementations bellow provide a template as well as guidlines for
|
|
/// implementing further tests.
|
|
/// </summary>
|
|
///
|
|
public abstract class CodeGeneratorTestBase
|
|
{
|
|
CodeDomProvider provider = null;
|
|
protected ICodeGenerator generator = null;
|
|
protected CodeGeneratorOptions options = null;
|
|
|
|
public void InitBase()
|
|
{
|
|
provider = new VBCodeProvider ();
|
|
generator = provider.CreateGenerator ();
|
|
options = new CodeGeneratorOptions ();
|
|
}
|
|
|
|
protected string Generate ()
|
|
{
|
|
return Generate (options);
|
|
}
|
|
|
|
protected virtual string NewLine
|
|
{
|
|
get { return "\n"; }
|
|
}
|
|
|
|
protected abstract string Generate (CodeGeneratorOptions options);
|
|
}
|
|
}
|