Files
acceptance-tests
data
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
packages
src
test
Microsoft.TestCommon
Microsoft.Web.Helpers.Test
Microsoft.Web.Http.Data.Test
Microsoft.Web.Mvc.Test
Microsoft.Web.WebPages.OAuth.Test
SPA.Test
System.Json.Test.Integration
System.Json.Test.Unit
System.Net.Http.Formatting.Test.Integration
System.Net.Http.Formatting.Test.Unit
System.Web.Helpers.Test
System.Web.Http.Integration.Test
System.Web.Http.SelfHost.Test
System.Web.Http.Test
System.Web.Http.WebHost.Test
System.Web.Mvc.Test
System.Web.Razor.Test
Editor
Framework
Generator
Parser
Properties
TestFiles
Text
Tokenizer
CSharpTokenizerCommentTest.cs
CSharpTokenizerIdentifierTest.cs
CSharpTokenizerLiteralTest.cs
CSharpTokenizerOperatorsTest.cs
CSharpTokenizerTest.cs
CSharpTokenizerTestBase.cs
HtmlTokenizerTest.cs
HtmlTokenizerTestBase.cs
TokenizerLookaheadTest.cs
TokenizerTestBase.cs
VBTokenizerCommentTest.cs
VBTokenizerIdentifierTest.cs
VBTokenizerLiteralTest.cs
VBTokenizerOperatorsTest.cs
VBTokenizerTest.cs
VBTokenizerTestBase.cs
Utils
CSharpRazorCodeLanguageTest.cs
CodeCompileUnitExtensions.cs
RazorCodeLanguageTest.cs
RazorDirectiveAttributeTest.cs
RazorEngineHostTest.cs
RazorTemplateEngineTest.cs
StringTextBuffer.cs
System.Web.Razor.Test.csproj
VBRazorCodeLanguageTest.cs
packages.config
System.Web.WebPages.Administration.Test
System.Web.WebPages.Deployment.Test
System.Web.WebPages.Razor.Test
System.Web.WebPages.Test
WebMatrix.Data.Test
WebMatrix.WebData.Test
Settings.StyleCop
tools
.gitattributes
.gitignore
License.txt
README.md
Runtime.msbuild
Runtime.sln
Runtime.xunit
Settings.StyleCop
build.cmd
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
libgc
llvm
m4
man
mcs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

97 lines
3.4 KiB
C#

// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Web.Razor.Tokenizer;
using System.Web.Razor.Tokenizer.Symbols;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
namespace System.Web.Razor.Test.Tokenizer
{
public class VBTokenizerTest : VBTokenizerTestBase
{
[Fact]
public void Constructor_Throws_ArgNull_If_Null_Source_Provided()
{
Assert.ThrowsArgumentNull(() => new CSharpTokenizer(null), "source");
}
[Fact]
public void Next_Returns_Null_When_EOF_Reached()
{
TestTokenizer("");
}
[Fact]
public void Next_Returns_Newline_Token_For_Single_CR()
{
TestTokenizer("\r\ra",
new VBSymbol(0, 0, 0, "\r", VBSymbolType.NewLine),
new VBSymbol(1, 1, 0, "\r", VBSymbolType.NewLine),
IgnoreRemaining);
}
[Fact]
public void Next_Returns_Newline_Token_For_Single_LF()
{
TestTokenizer("\n\na",
new VBSymbol(0, 0, 0, "\n", VBSymbolType.NewLine),
new VBSymbol(1, 1, 0, "\n", VBSymbolType.NewLine),
IgnoreRemaining);
}
[Fact]
public void Next_Returns_Newline_Token_For_Single_NEL()
{
// NEL: Unicode "Next Line" U+0085
TestTokenizer("\u0085\u0085a",
new VBSymbol(0, 0, 0, "\u0085", VBSymbolType.NewLine),
new VBSymbol(1, 1, 0, "\u0085", VBSymbolType.NewLine),
IgnoreRemaining);
}
[Fact]
public void Next_Returns_Newline_Token_For_Single_Line_Separator()
{
// Unicode "Line Separator" U+2028
TestTokenizer("\u2028\u2028a",
new VBSymbol(0, 0, 0, "\u2028", VBSymbolType.NewLine),
new VBSymbol(1, 1, 0, "\u2028", VBSymbolType.NewLine),
IgnoreRemaining);
}
[Fact]
public void Next_Returns_Newline_Token_For_Single_Paragraph_Separator()
{
// Unicode "Paragraph Separator" U+2029
TestTokenizer("\u2029\u2029a",
new VBSymbol(0, 0, 0, "\u2029", VBSymbolType.NewLine),
new VBSymbol(1, 1, 0, "\u2029", VBSymbolType.NewLine),
IgnoreRemaining);
}
[Fact]
public void Next_Returns_Single_Newline_Token_For_CRLF()
{
TestTokenizer("\r\n\r\na",
new VBSymbol(0, 0, 0, "\r\n", VBSymbolType.NewLine),
new VBSymbol(2, 1, 0, "\r\n", VBSymbolType.NewLine),
IgnoreRemaining);
}
[Fact]
public void Next_Returns_Token_For_Whitespace_Characters()
{
TestTokenizer(" \f\t\u000B \n ",
new VBSymbol(0, 0, 0, " \f\t\u000B ", VBSymbolType.WhiteSpace),
new VBSymbol(5, 0, 5, "\n", VBSymbolType.NewLine),
new VBSymbol(6, 1, 0, " ", VBSymbolType.WhiteSpace));
}
[Fact]
public void Transition_Is_Recognized()
{
TestSingleToken("@", VBSymbolType.Transition);
}
}
}