Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1304 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
4 changed files with 178 additions and 9 deletions
@ -0,0 +1,102 @@ |
|||||||
|
// <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 ICSharpCode.XmlEditor; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
using System.Xml; |
||||||
|
|
||||||
|
namespace XmlEditor.Tests.Parser |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class InsideAttributeValueTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void InvalidString() |
||||||
|
{ |
||||||
|
Assert.IsFalse(XmlParser.IsInsideAttributeValue(String.Empty, 10)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void DoubleQuotesTest1() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\""; |
||||||
|
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void DoubleQuotesTest2() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\"\" "; |
||||||
|
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void DoubleQuotesTest3() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\"\""; |
||||||
|
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void DoubleQuotesTest4() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\" "; |
||||||
|
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void NoXmlElementStart() |
||||||
|
{ |
||||||
|
string xml = "foo a=\""; |
||||||
|
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void EqualsSignTest() |
||||||
|
{ |
||||||
|
string xml = "<foo a="; |
||||||
|
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void SingleQuoteTest1() |
||||||
|
{ |
||||||
|
string xml = "<foo a='"; |
||||||
|
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void MixedQuotesTest1() |
||||||
|
{ |
||||||
|
string xml = "<foo a='\""; |
||||||
|
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void MixedQuotesTest2() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\"'"; |
||||||
|
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void MixedQuotesTest3() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\"''"; |
||||||
|
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void MixedQuotesTest4() |
||||||
|
{ |
||||||
|
string xml = "<foo a=\"''\""; |
||||||
|
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue