Skip to content

Commit

Permalink
updated regex for IsFullyQualified to include numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
david committed Oct 24, 2005
1 parent b4f0084 commit 14ca19e
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 49 deletions.
13 changes: 6 additions & 7 deletions dotnet/src/acceptanceTests/acceptanceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
HintPath = "..\..\..\..\..\apps\nunit\NUnit V2.1\\bin\nunit.framework.dll"
AssemblyFolderKey = "hklm\dn\nunit.framework"
/>
<Reference
Name = "fit"
Project = "{483287D5-0C87-4257-AB40-C75C02F2ECF6}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "True"
/>
<Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
HintPath = "..\..\..\..\..\..\apps\NUnit 2.2\bin\nunit.framework.dll"
AssemblyFolderKey = "hklm\dn\nunit.framework"
/>
</References>
</Build>
Expand Down
7 changes: 1 addition & 6 deletions dotnet/src/fit/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.
using System.Reflection;
using System.Runtime.InteropServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly : AssemblyTitle("")]
[assembly : AssemblyTitle("fitnesse-dotnet")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
Expand Down Expand Up @@ -56,7 +55,3 @@
// documentation for more information on this.
//

[assembly : AssemblyDelaySign(false)]
[assembly : AssemblyKeyFile(@"../../../../fitnesse.key")]
[assembly : AssemblyKeyName("")]
[assembly : Guid("CCCDC85E-F60D-41de-B032-C711214F6666")]
2 changes: 0 additions & 2 deletions dotnet/src/fit/FileRunner.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Modified or written by Object Mentor, Inc. for inclusion with FitNesse.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.

using System;
using System.IO;
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/fit/FileRunnerExe.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Modified or written by Object Mentor, Inc. for inclusion with FitNesse.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.

using System;
using System.IO;
Expand Down
10 changes: 7 additions & 3 deletions dotnet/src/fit/FixtureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public void testMissingFixtureError()
Assert.IsTrue(message.IndexOf("Assemblies searched") > 0);
Assert.IsTrue(message.ToLower().IndexOf("fit.dll") > 0, message);
}
}

[TestFixture]
public class FixtureParametersTest{

[Test]
public void TestFixtureParametersNoAdditionalCell()
public void NoParameterCellsShouldResultInNoArguments()
{
string tableString = "<table><tr><td>StringFixture</td></tr><tr><td>field</td><td>field</td></tr></table>";
Fixture fixture = new Fixture();
Expand All @@ -43,7 +47,7 @@ public void TestFixtureParametersNoAdditionalCell()
}

[Test]
public void TestFixtureParametersOneParam()
public void OneParameterCellShouldResultInOneArgument()
{
string arg = "I'd like to buy an argument";
string tableString = "<table><tr><td>StringFixture</td><td>" + arg + "</td></tr><tr><td>field</td><td>field</td></tr></table>";
Expand All @@ -55,7 +59,7 @@ public void TestFixtureParametersOneParam()
}

[Test]
public void TestFixtureParametersTwoParams()
public void TwoParameterCellShouldResultInTwoArguments()
{
string arg1 = "I'd like to buy an argument";
string arg2 = "I'd like to buy another argument";
Expand Down
9 changes: 4 additions & 5 deletions dotnet/src/fit/ObjectFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Released under the terms of the GNU General Public License version 2 or later.
using System;
using System.Collections;
using System.Configuration;
using System.IO;
using System.Reflection;
using System.Text;
Expand Down Expand Up @@ -55,11 +54,11 @@ public static void AddAssembly(string assemblyPath)
DirectoryInfo directoryInfo = fileInfo.Directory;
foreach (FileInfo configFileInfo in directoryInfo.GetFiles("*.config"))
{
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE",configFileInfo);
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configFileInfo);
}
}
//TODO - explain why we need to catch exceptions but don't
//need to do anything with them
//TODO - explain why we need to catch exceptions but don't
//need to do anything with them
catch (Exception)
{}
}
Expand Down Expand Up @@ -93,7 +92,7 @@ private object GetInstance(TypeName typeName, Assembly assembly, Type type)
{
return assembly.CreateInstance(type.FullName);
}
catch(NullReferenceException)
catch (NullReferenceException)
{
throw new ApplicationException(GetCouldNotFindTypeMessage(typeName.OriginalName));
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/fit/Parse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static int ProtectedIndexOf(string text, string searchValue, int offset,
public Parse(string text, string[] tags, int level, int offset)
{
string lc = text.ToLower();
string target = tags[level];
string target = tags[level].ToLower();

int startTag = ProtectedIndexOf(lc, "<" + target, 0, target);
int endTag = ProtectedIndexOf(lc, ">", startTag, target) + 1;
Expand Down
71 changes: 53 additions & 18 deletions dotnet/src/fit/ParseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ParseTest
{

[Test]
public void TestUnEscape()
public void UnEscapeShouldRemoveHtmlEscapes()
{
Assert.AreEqual("a<b", Parse.UnEscape("a&lt;b"));
Assert.AreEqual("a>b & b>c &&", Parse.UnEscape("a&gt;b&nbsp;&amp;&nbsp;b>c &&"));
Expand All @@ -20,45 +20,80 @@ public void TestUnEscape()
}

[Test]
public void TestUnFormat()
public void UnFormatShouldRemoveHtmlFormattingCodeIfPresent()
{
Assert.AreEqual("ab",Parse.UnFormat("<font size=+1>a</font>b"));
Assert.AreEqual("ab",Parse.UnFormat("a<font size=+1>b</font>"));
Assert.AreEqual("a<b",Parse.UnFormat("a<b"));
}

[Test]
public void TestParsing()
public void LeaderShouldReturnAllHtmlTextBeforeTheParse()
{
Parse p = new Parse("leader<Table foo=2>body</table>trailer", new string[] {"table"});
Assert.AreEqual("leader", p.Leader);
Parse p = new Parse("<html><head></head><body><Table foo=2>body</table></body></html>", new string[] {"table"});
Assert.AreEqual("<html><head></head><body>", p.Leader);
Assert.AreEqual("<Table foo=2>", p.Tag);
Assert.AreEqual("body", p.Body);
Assert.AreEqual("trailer", p.Trailer);
Assert.AreEqual("</body></html>", p.Trailer);
}

private Parse SimpleTableParse
{
get { return new Parse("leader<table><tr><td>body</td></tr></table>trailer"); }
}

[Test]
public void BodyShouldReturnNullForTables()
{
Parse parse = SimpleTableParse;
Assert.AreEqual(null, parse.Body);
}

[Test]
public void BodyShouldReturnNullForRows()
{
Parse parse = SimpleTableParse;
Assert.AreEqual(null, parse.Parts.Body);
}

[Test]
public void BodyShouldReturnTextForCells()
{
Parse parse = SimpleTableParse;
Assert.AreEqual("body", parse.Parts.Parts.Body);
}

[Test]
public void TestRecursing()
public void PartsShouldReturnCellsWhenTheParseRepresentsARow()
{
Parse p = new Parse("leader<table><TR><Td>body</tD></TR></table>trailer");
Assert.AreEqual(null, p.Body);
Assert.AreEqual(null, p.Parts.Body);
Assert.AreEqual("body", p.Parts.Parts.Body);
Parse row = new Parse("<tr><td>one</td><td>two</td><td>three</td></tr>", new string[]{"tr", "td"});
Assert.AreEqual("one", row.Parts.Body);
Assert.AreEqual("two", row.Parts.More.Body);
Assert.AreEqual("three", row.Parts.More.More.Body);
}

[Test]
public void TestIterating()
public void PartsShouldReturnRowsWhenTheParseRepresentsATable()
{
Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr></table>trailer");
Assert.AreEqual("one", p.Parts.Parts.Body);
Assert.AreEqual("two", p.Parts.Parts.More.Body);
Assert.AreEqual("three", p.Parts.Parts.More.More.Body);
Parse table = new Parse("<table><tr><td>row one</td></tr><tr><td>row two</td></tr></table>", new string[] {"table", "tr", "td"});
Assert.AreEqual("row one", table.Parts.Parts.Body);
Assert.AreEqual("row two", table.Parts.More.Parts.Body);
}

[Test]
public void TestIndexing()
public void TestIndexingPage()
{
Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr><tr><td>four</td></tr></table>trailer");
Parse p = new Parse(
@"leader
<table>
<tr>
<td>one</td><td>two</td><td>three</td>
</tr>
<tr>
<td>four</td>
</tr>
</table>
trailer");
Assert.AreEqual("one", p.At(0,0,0).Body);
Assert.AreEqual("two", p.At(0,0,1).Body);
Assert.AreEqual("three", p.At(0,0,2).Body);
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/fit/PrimitiveFixture.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Modified or written by Object Mentor, Inc. for inclusion with FitNesse.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.

namespace fit
{
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/fit/RowFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Released under the terms of the GNU General Public License version 2 or later.
// Copyright (C) 2003,2004 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the GNU General Public License version 2 or later.
// Copyright (c) 2002 Cunningham & Cunningham, Inc.
// Released under the terms of the GNU General Public License version 2 or later.
using System;
using System.Collections;

Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/fit/TypeName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public string Namespace

public bool IsFullyQualified()
{
return Regex.IsMatch(name, "^([A-Za-z_]+\\.)+[A-Za-z_]+$");
return Regex.IsMatch(name, "^([A-Za-z0-9_]+\\.)+[A-Za-z0-9_]+$");
}

public string OriginalName
Expand Down
6 changes: 6 additions & 0 deletions dotnet/src/fit/TypeNameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public void TestIsFullyQualified() {
Assert.IsFalse(new TypeName("this . is . not . fully . qualified").IsFullyQualified());
}

[Test]
public void IsFullyQualifiedShouldAllowNumbers()
{
Assert.IsTrue(new TypeName("This1.Is2.FullyQualified3").IsFullyQualified());
}

[Test]
public void TestOriginalName()
{
Expand Down

0 comments on commit 14ca19e

Please sign in to comment.