|
| 1 | +using NUnit.Framework; |
| 2 | +using TextMateSharp.Internal.Grammars; |
| 3 | + |
| 4 | +namespace TextMateSharp.Tests.Internal.Grammars |
| 5 | +{ |
| 6 | + [TestFixture] |
| 7 | + internal class AttributedScopeStackTests |
| 8 | + { |
| 9 | + [Test] |
| 10 | + public void Equals_ShouldMatchEquivalentStacks() |
| 11 | + { |
| 12 | + AttributedScopeStack stack1 = new AttributedScopeStack(new AttributedScopeStack(null, "source.cs", 1), "meta.test", 2); |
| 13 | + AttributedScopeStack stack2 = new AttributedScopeStack(new AttributedScopeStack(null, "source.cs", 1), "meta.test", 2); |
| 14 | + |
| 15 | + Assert.IsTrue(stack1.Equals(stack2)); |
| 16 | + Assert.IsTrue(stack2.Equals(stack1)); |
| 17 | + } |
| 18 | + |
| 19 | + [Test] |
| 20 | + public void Equals_ShouldReturnFalseForDifferentStacks() |
| 21 | + { |
| 22 | + AttributedScopeStack stack1 = new AttributedScopeStack(new AttributedScopeStack(null, "source.cs", 1), "meta.test", 2); |
| 23 | + AttributedScopeStack stack2 = new AttributedScopeStack(new AttributedScopeStack(null, "source.cs", 1), "meta.other", 2); |
| 24 | + |
| 25 | + Assert.IsFalse(stack1.Equals(stack2)); |
| 26 | + Assert.IsFalse(stack2.Equals(stack1)); |
| 27 | + } |
| 28 | + |
| 29 | + [Test] |
| 30 | + public void Equals_ShouldReturnFalseForDifferentType() |
| 31 | + { |
| 32 | + AttributedScopeStack stack = new AttributedScopeStack(null, "source.cs", 1); |
| 33 | + |
| 34 | + Assert.IsFalse(stack.Equals(42)); |
| 35 | + } |
| 36 | + |
| 37 | + [Test] |
| 38 | + public void Equals_ShouldReturnFalseForNull() |
| 39 | + { |
| 40 | + AttributedScopeStack stack = new AttributedScopeStack(null, "source.cs", 1); |
| 41 | + |
| 42 | + Assert.IsFalse(stack.Equals(null)); |
| 43 | + } |
| 44 | + } |
| 45 | +} |
0 commit comments