~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/UnaryOperatorExpressionTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.IO;
 
6
using NUnit.Framework;
 
7
using ICSharpCode.NRefactory.VB.Parser;
 
8
using ICSharpCode.NRefactory.VB.Ast;
 
9
 
 
10
namespace ICSharpCode.NRefactory.VB.Tests.Ast
 
11
{
 
12
        [TestFixture]
 
13
        public class UnaryOperatorExpressionTests
 
14
        {
 
15
                #region VB.NET
 
16
                void VBNetTestUnaryOperatorExpressionTest(string program, UnaryOperatorType op)
 
17
                {
 
18
                        UnaryOperatorExpression uoe = ParseUtil.ParseExpression<UnaryOperatorExpression>(program);
 
19
                        Assert.AreEqual(op, uoe.Op);
 
20
                        
 
21
                        Assert.IsTrue(uoe.Expression is SimpleNameExpression);
 
22
                }
 
23
                
 
24
                [Test]
 
25
                public void VBNetNotTest()
 
26
                {
 
27
                        VBNetTestUnaryOperatorExpressionTest("Not a", UnaryOperatorType.Not);
 
28
                }
 
29
                
 
30
                [Test]
 
31
                public void VBNetInEqualsNotTest()
 
32
                {
 
33
                        BinaryOperatorExpression e = ParseUtil.ParseExpression<BinaryOperatorExpression>("b <> Not a");
 
34
                        Assert.AreEqual(BinaryOperatorType.InEquality, e.Op);
 
35
                        UnaryOperatorExpression ue = (UnaryOperatorExpression)e.Right;
 
36
                        Assert.AreEqual(UnaryOperatorType.Not, ue.Op);
 
37
                }
 
38
                
 
39
                [Test]
 
40
                public void VBNetNotEqualTest()
 
41
                {
 
42
                        UnaryOperatorExpression e = ParseUtil.ParseExpression<UnaryOperatorExpression>("Not a = b");
 
43
                        Assert.AreEqual(UnaryOperatorType.Not, e.Op);
 
44
                        BinaryOperatorExpression boe = (BinaryOperatorExpression)e.Expression;
 
45
                        Assert.AreEqual(BinaryOperatorType.Equality, boe.Op);
 
46
                }
 
47
                
 
48
                [Test]
 
49
                public void VBNetPlusTest()
 
50
                {
 
51
                        VBNetTestUnaryOperatorExpressionTest("+a", UnaryOperatorType.Plus);
 
52
                }
 
53
                
 
54
                [Test]
 
55
                public void VBNetMinusTest()
 
56
                {
 
57
                        VBNetTestUnaryOperatorExpressionTest("-a", UnaryOperatorType.Minus);
 
58
                }
 
59
                #endregion
 
60
        }
 
61
}