2
using MonoDevelop.XmlEditor;
6
namespace MonoDevelop.XmlEditor.Tests.Parser
9
public class AttributeValueUnderCursorTests
12
public void SuccessTest1()
14
string text = "<a foo='abc'";
15
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
19
public void SuccessTest2()
21
string text = "<a foo=\"abc\"";
22
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
26
public void SuccessTest3()
28
string text = "<a foo='abc'";
29
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 2));
33
public void SuccessTest4()
35
string text = "<a foo='abc'";
36
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.IndexOf("abc")));
40
public void SuccessTest5()
42
string text = "<a foo=''";
43
Assert.AreEqual(String.Empty, XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
47
public void SuccessTest6()
49
string text = "<a foo='a'";
50
Assert.AreEqual("a", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
54
public void SuccessTest7()
56
string text = "<a foo='a\"b\"c'";
57
Assert.AreEqual("a\"b\"c", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
61
public void FailureTest1()
63
string text = "<a foo='a";
64
Assert.AreEqual(String.Empty, XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));