forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompilerErrorTests.cs
More file actions
46 lines (42 loc) · 1.62 KB
/
CompilerErrorTests.cs
File metadata and controls
46 lines (42 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.CodeDom.Compiler.Tests
{
public class CompilerErrorTests
{
[Fact]
public void Ctor_Default()
{
var error = new CompilerError();
Assert.Equal(0, error.Column);
Assert.Empty(error.ErrorNumber);
Assert.Empty(error.ErrorText);
Assert.Empty(error.FileName);
Assert.False(error.IsWarning);
Assert.Equal(0, error.Line);
}
[Theory]
[InlineData(null, 0, 0, null, null)]
[InlineData("", -1, -1, "", "")]
[InlineData("fileName", 1, 1, "errorNumber", "errorText")]
public void Ctor_String_Int_Int_String_String(string fileName, int line, int column, string errorNumber, string errorText)
{
var error = new CompilerError(fileName, line, column, errorNumber, errorText);
Assert.Equal(column, error.Column);
Assert.Equal(errorNumber, error.ErrorNumber);
Assert.Equal(errorText, error.ErrorText);
Assert.Equal(fileName, error.FileName);
Assert.False(error.IsWarning);
Assert.Equal(line, error.Line);
}
[Theory]
[InlineData(true, "warning : ")]
[InlineData(false, "error : ")]
public void ToString_Invoke_ReturnsExpected(bool isWarning, string expected)
{
var error = new CompilerError { IsWarning = isWarning };
Assert.Equal(expected, error.ToString());
}
}
}