mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt) |
|
|
|
using System; |
|
using NUnit.Framework; |
|
|
|
namespace ICSharpCode.NRefactory.CSharp.Parser.Expression |
|
{ |
|
[TestFixture] |
|
public class ArrayObjectCreateExpressionTests |
|
{ |
|
[Test] |
|
public void ArrayCreateExpressionTest1() |
|
{ |
|
ParseUtilCSharp.AssertExpression( |
|
"new int[5]", |
|
new ArrayCreateExpression { |
|
Type = new PrimitiveType("int"), |
|
Arguments = { new PrimitiveExpression(5) } |
|
}); |
|
} |
|
|
|
[Test] |
|
public void MultidimensionalNestedArray() |
|
{ |
|
ParseUtilCSharp.AssertExpression( |
|
"new int[5,2][,,][]", |
|
new ArrayCreateExpression { |
|
Type = new PrimitiveType("int"), |
|
Arguments = { new PrimitiveExpression(5), new PrimitiveExpression(2) }, |
|
AdditionalArraySpecifiers = { |
|
new ArraySpecifier(3), |
|
new ArraySpecifier(1) |
|
} |
|
}); |
|
} |
|
|
|
[Test] |
|
public void ImplicitlyTypedArrayCreateExpression() |
|
{ |
|
ParseUtilCSharp.AssertExpression( |
|
"new[] { 1, 10, 100, 1000 }", |
|
new ArrayCreateExpression { |
|
Initializer = new ArrayInitializerExpression { |
|
Elements = { |
|
new PrimitiveExpression(1), |
|
new PrimitiveExpression(10), |
|
new PrimitiveExpression(100), |
|
new PrimitiveExpression(1000) |
|
} |
|
} |
|
}); |
|
|
|
} |
|
} |
|
}
|
|
|