~ubuntu-branches/ubuntu/feisty/monodevelop/feisty

« back to all changes in this revision

Viewing changes to Core/src/NRefactory/Test/Parser/GlobalScope/AttributeSectionTests.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-09-15 02:15:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060915021525-ngsnriip5e3uqi9d
Tags: 0.12-0ubuntu1
* New upstream release
* debian/patches/gtk-sharp-2.10.dpatch,
  debian/patches/versioncontrol_buildfix.dpatch:
  + Dropped, merged upstream
* debian/patches/use_nunit2.2.dpatch,
  debian/patches/firefox.dpatch:
  + Updated

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// <file>
2
 
//     <copyright see="prj:///doc/copyright.txt"/>
3
 
//     <license see="prj:///doc/license.txt"/>
4
 
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
 
//     <version>$Revision: 915 $</version>
6
 
// </file>
7
 
 
8
 
using System;
9
 
using System.IO;
10
 
using NUnit.Framework;
11
 
using ICSharpCode.NRefactory.Parser;
12
 
using ICSharpCode.NRefactory.Parser.VB;
13
 
using ICSharpCode.NRefactory.Parser.AST;
14
 
 
15
 
namespace ICSharpCode.NRefactory.Tests.AST
16
 
{
17
 
        [TestFixture]
18
 
        public class AttributeSectionTests
19
 
        {
20
 
                [Test]
21
 
                public void AttributeOnStructure()
22
 
                {
23
 
                        string program = @"
24
 
<StructLayout( LayoutKind.Explicit )> _
25
 
Public Structure MyUnion
26
 
 
27
 
        <FieldOffset( 0 )> Public i As Integer
28
 
        < FieldOffset( 0 )> Public d As Double
29
 
        
30
 
End Structure 'MyUnion
31
 
";
32
 
                        TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
33
 
                        Assert.AreEqual("StructLayout", decl.Attributes[0].Attributes[0].Name);
34
 
                }
35
 
                
36
 
                [Test]
37
 
                public void AttributeOnModule()
38
 
                {
39
 
                        string program = @"
40
 
<HideModule> _
41
 
Public Module MyExtra
42
 
 
43
 
        Public i As Integer
44
 
        Public d As Double
45
 
        
46
 
End Module
47
 
";
48
 
                        TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
49
 
                        Assert.AreEqual("HideModule", decl.Attributes[0].Attributes[0].Name);
50
 
                }
51
 
                
52
 
                [Test]
53
 
                public void GlobalAttributeVB()
54
 
                {
55
 
                        string program = @"<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
56
 
Public Class Form1
57
 
        
58
 
End Class";
59
 
                        TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
60
 
                        Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
61
 
                }
62
 
                
63
 
                [Test]
64
 
                public void GlobalAttributeCSharp()
65
 
                {
66
 
                        string program = @"[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
67
 
[someprefix::DesignerGenerated()]
68
 
public class Form1 {
69
 
}";
70
 
                        TypeDeclaration decl = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
71
 
                        Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
72
 
                        Assert.AreEqual("someprefix.DesignerGenerated", decl.Attributes[1].Attributes[0].Name);
73
 
                }
74
 
        }
75
 
}