From 851dd7ba3b14bbcf9994db5e4099ee7daf6fab59 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Thu, 19 Jan 2017 13:24:09 -0800 Subject: [PATCH] Add support for TagHelper directives This commit adds support to the TagHelperBinderSyntaxTreePass to interpret @addTagHelper, @removeTagHelper, and @tagHelperPrefix. I also ported all the original tests for this feature and updated them to call new APIs. The bulk of the changes here were updates to baseline tests that weren't correctly using @addTagHelper --- .../Legacy/ITagHelperDescriptorResolver.cs | 10 +- .../TagHelperDescriptorResolutionContext.cs | 54 - .../Properties/Resources.Designer.cs | 64 + .../Resources.resx | 12 + .../TagHelperBinderSyntaxTreePass.cs | 250 +++- .../CodeGenerationIntegrationTest.cs | 16 - .../InstrumentationPassIntegrationTest.cs | 7 +- .../TagHelpersIntegrationTest.cs | 11 +- .../TestTagHelperDescriptors.cs | 59 +- ...aultRazorIRLoweringPhaseIntegrationTest.cs | 38 +- .../RazorEngineBuilderExtensions.cs | 12 - .../TagHelperBinderSyntaxTreePassTest.cs | 1057 ++++++++++++++++- .../AddTagHelperDirective.cshtml | 2 +- .../AttributeTargetingTagHelpers.cshtml | 2 +- ...argetingTagHelpers_DesignTime.mappings.txt | 4 +- ...buteTargetingTagHelpers_Runtime.codegen.cs | 2 +- .../BasicTagHelpers.cshtml | 2 +- .../BasicTagHelpers_Prefixed.cshtml | 2 +- ...agHelpers_Prefixed_DesignTime.mappings.txt | 2 +- ...asicTagHelpers_Prefixed_Runtime.codegen.cs | 2 +- .../BasicTagHelpers_RemoveTagHelper.cshtml | 2 +- .../BasicTagHelpers_Runtime.codegen.cs | 2 +- .../ComplexTagHelpers.cshtml | 2 +- .../ComplexTagHelpers_DesignTime.mappings.txt | 80 +- .../ComplexTagHelpers_Runtime.codegen.cs | 8 +- .../CssSelectorTagHelperAttributes.cshtml | 2 +- .../DuplicateAttributeTagHelpers.cshtml | 2 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 6 +- ...cateAttributeTagHelpers_Runtime.codegen.cs | 2 +- .../DuplicateTargetTagHelper.cshtml | 2 +- ...ateTargetTagHelper_DesignTime.mappings.txt | 2 +- ...uplicateTargetTagHelper_Runtime.codegen.cs | 2 +- .../DynamicAttributeTagHelpers.cshtml | 2 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 60 +- ...amicAttributeTagHelpers_Runtime.codegen.cs | 40 +- .../EmptyAttributeTagHelpers.cshtml | 2 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 6 +- ...mptyAttributeTagHelpers_Runtime.codegen.cs | 2 +- .../EnumTagHelpers.cshtml | 2 +- .../EnumTagHelpers_DesignTime.mappings.txt | 16 +- .../EnumTagHelpers_Runtime.codegen.cs | 4 +- .../EscapedTagHelpers.cshtml | 2 +- .../EscapedTagHelpers_DesignTime.mappings.txt | 6 +- .../EscapedTagHelpers_Runtime.codegen.cs | 2 +- .../IncompleteTagHelper.cshtml | 2 +- .../IncompleteTagHelper_Runtime.codegen.cs | 2 +- .../MinimizedTagHelpers.cshtml | 2 +- .../NestedScriptTagTagHelpers.cshtml | 2 +- ...criptTagTagHelpers_DesignTime.mappings.txt | 8 +- ...stedScriptTagTagHelpers_Runtime.codegen.cs | 2 +- .../PrefixedAttributeTagHelpers.cshtml | 2 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 22 +- ...ixedAttributeTagHelpers_Runtime.codegen.cs | 2 +- .../RemoveTagHelperDirective.cshtml | 2 +- .../SingleTagHelper.cshtml | 2 +- ...agHelperWithNewlineBeforeAttributes.cshtml | 2 +- ...neBeforeAttributes_DesignTime.mappings.txt | 2 +- ...NewlineBeforeAttributes_Runtime.codegen.cs | 2 +- .../SingleTagHelper_DesignTime.mappings.txt | 2 +- .../SingleTagHelper_Runtime.codegen.cs | 2 +- .../SymbolBoundAttributes.cshtml | 2 +- ...bolBoundAttributes_DesignTime.mappings.txt | 8 +- .../SymbolBoundAttributes_Runtime.codegen.cs | 2 +- .../TagHelpersInSection.cshtml | 2 +- ...gHelpersWithWeirdlySpacedAttributes.cshtml | 2 +- ...lySpacedAttributes_DesignTime.mappings.txt | 6 +- ...WeirdlySpacedAttributes_Runtime.codegen.cs | 2 +- .../TransitionsInTagHelperAttributes.cshtml | 2 +- ...agHelperAttributes_DesignTime.mappings.txt | 32 +- ...nsInTagHelperAttributes_Runtime.codegen.cs | 12 +- .../TestTagHelperDescriptorResolver.cs | 27 + 71 files changed, 1633 insertions(+), 386 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Razor.Evolution/Legacy/TagHelperDescriptorResolutionContext.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestTagHelperDescriptorResolver.cs diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/ITagHelperDescriptorResolver.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/ITagHelperDescriptorResolver.cs index abe5283b66..83d7540b51 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/ITagHelperDescriptorResolver.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/ITagHelperDescriptorResolver.cs @@ -10,14 +10,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Legacy /// internal interface ITagHelperDescriptorResolver { - /// - /// Resolves s based on the given . - /// - /// - /// used to resolve descriptors for the Razor page. - /// - /// An of s based - /// on the given . - IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext); + IEnumerable Resolve(ErrorSink errorSink); } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/TagHelperDescriptorResolutionContext.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/TagHelperDescriptorResolutionContext.cs deleted file mode 100644 index ee0d6767eb..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/TagHelperDescriptorResolutionContext.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Razor.Evolution.Legacy -{ - /// - /// Contains information needed to resolve s. - /// - internal class TagHelperDescriptorResolutionContext - { - // Internal for testing purposes - internal TagHelperDescriptorResolutionContext(IEnumerable directiveDescriptors) - : this(directiveDescriptors, new ErrorSink()) - { - } - - /// - /// Instantiates a new instance of . - /// - /// s used to resolve - /// s. - /// Used to aggregate s. - public TagHelperDescriptorResolutionContext( - IEnumerable directiveDescriptors, - ErrorSink errorSink) - { - if (directiveDescriptors == null) - { - throw new ArgumentNullException(nameof(directiveDescriptors)); - } - - if (errorSink == null) - { - throw new ArgumentNullException(nameof(errorSink)); - } - - DirectiveDescriptors = new List(directiveDescriptors); - ErrorSink = errorSink; - } - - /// - /// s used to resolve s. - /// - public IList DirectiveDescriptors { get; private set; } - - /// - /// Used to aggregate s. - /// - public ErrorSink ErrorSink { get; private set; } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Properties/Resources.Designer.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Properties/Resources.Designer.cs index 65cf6f06b2..45f3012e6f 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Properties/Resources.Designer.cs @@ -26,6 +26,38 @@ namespace Microsoft.AspNetCore.Razor.Evolution return string.Format(CultureInfo.CurrentCulture, GetString("FeatureDependencyMissing"), p0, p1, p2); } + /// + /// Invalid tag helper directive look up text '{0}'. The correct look up text format is: "typeName, assemblyName". + /// + internal static string InvalidTagHelperLookupText + { + get { return GetString("InvalidTagHelperLookupText"); } + } + + /// + /// Invalid tag helper directive look up text '{0}'. The correct look up text format is: "typeName, assemblyName". + /// + internal static string FormatInvalidTagHelperLookupText(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("InvalidTagHelperLookupText"), p0); + } + + /// + /// Invalid tag helper directive '{0}' value. '{1}' is not allowed in prefix '{2}'. + /// + internal static string InvalidTagHelperPrefixValue + { + get { return GetString("InvalidTagHelperPrefixValue"); } + } + + /// + /// Invalid tag helper directive '{0}' value. '{1}' is not allowed in prefix '{2}'. + /// + internal static string FormatInvalidTagHelperPrefixValue(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("InvalidTagHelperPrefixValue"), p0, p1, p2); + } + /// /// The '{0}' operation is not valid when the builder is empty. /// @@ -90,6 +122,38 @@ namespace Microsoft.AspNetCore.Razor.Evolution return string.Format(CultureInfo.CurrentCulture, GetString("PhaseMustBeInitialized"), p0); } + /// + /// Tag helper directive assembly name cannot be null or empty. + /// + internal static string TagHelperAssemblyNameCannotBeEmptyOrNull + { + get { return GetString("TagHelperAssemblyNameCannotBeEmptyOrNull"); } + } + + /// + /// Tag helper directive assembly name cannot be null or empty. + /// + internal static string FormatTagHelperAssemblyNameCannotBeEmptyOrNull() + { + return GetString("TagHelperAssemblyNameCannotBeEmptyOrNull"); + } + + /// + /// The assembly '{0}' could not be resolved or contains no tag helpers. + /// + internal static string TagHelperAssemblyCouldNotBeResolved + { + get { return GetString("TagHelperAssemblyCouldNotBeResolved"); } + } + + /// + /// The assembly '{0}' could not be resolved or contains no tag helpers. + /// + internal static string FormatTagHelperAssemblyCouldNotBeResolved(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TagHelperAssemblyCouldNotBeResolved"), p0); + } + private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name); diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Resources.resx b/src/Microsoft.AspNetCore.Razor.Evolution/Resources.resx index d893797c8d..c41ba721b4 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Resources.resx +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Resources.resx @@ -120,6 +120,12 @@ The '{0}' feature requires a '{1}' provided by the '{2}'. + + Invalid tag helper directive look up text '{0}'. The correct look up text format is: "typeName, assemblyName". + + + Invalid tag helper directive '{0}' value. '{1}' is not allowed in prefix '{2}'. + The '{0}' operation is not valid when the builder is empty. @@ -132,4 +138,10 @@ The phase must be initialized by setting the '{0}' property. + + Tag helper directive assembly name cannot be null or empty. + + + The assembly '{0}' could not be resolved or contains no tag helpers. + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/TagHelperBinderSyntaxTreePass.cs b/src/Microsoft.AspNetCore.Razor.Evolution/TagHelperBinderSyntaxTreePass.cs index c066a79906..0874f7c567 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/TagHelperBinderSyntaxTreePass.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/TagHelperBinderSyntaxTreePass.cs @@ -4,13 +4,17 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Evolution.Legacy; namespace Microsoft.AspNetCore.Razor.Evolution { internal class TagHelperBinderSyntaxTreePass : IRazorSyntaxTreePass { + private static HashSet InvalidNonWhitespaceNameCharacters = new HashSet(new[] + { + '@', '!', '<', '/', '?', '[', '>', ']', '=', '"', '\'', '*' + }); + public RazorEngine Engine { get; set; } public int Order => 150; @@ -28,7 +32,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution // // The imports come logically before the main razor file and are in the order they // should be processed. - var visitor = new Visitor(); + var visitor = new DirectiveVisitor(); var imports = codeDocument.GetImportSyntaxTrees(); if (imports != null) { @@ -41,10 +45,13 @@ namespace Microsoft.AspNetCore.Razor.Evolution visitor.VisitBlock(syntaxTree.Root); - var directives = visitor.Directives; var errorSink = new ErrorSink(); - var descriptors = resolver.Resolve(new TagHelperDescriptorResolutionContext(directives, errorSink)).ToArray(); - if (descriptors.Length == 0) + var directives = visitor.Directives; + var descriptors = (IReadOnlyList)resolver.Resolve(errorSink).ToList(); + + descriptors = ProcessDirectives(directives, descriptors, errorSink); + + if (descriptors.Count == 0) { // No TagHelpers, add any errors if we have them. if (errorSink.Errors.Count > 0) @@ -70,6 +77,228 @@ namespace Microsoft.AspNetCore.Razor.Evolution return newSyntaxTree; } + internal IReadOnlyList ProcessDirectives( + IReadOnlyList directives, + IReadOnlyList tagHelpers, + ErrorSink errorSink) + { + var matches = new HashSet(TagHelperDescriptorComparer.Default); + + // We only support a single prefix directive. + TagHelperDirectiveDescriptor prefixDirective = null; + + for (var i = 0; i < directives.Count; i++) + { + var directive = directives[i]; + + ParsedDirective parsed; + switch (directive.DirectiveType) + { + case TagHelperDirectiveType.AddTagHelper: + + parsed = ParseAddOrRemoveDirective(directive, errorSink); + if (parsed == null) + { + // Skip this one, it's an error + break; + } + + if (!AssemblyContainsTagHelpers(parsed.AssemblyName, tagHelpers)) + { + errorSink.OnError( + parsed.AssemblyNameLocation, + Resources.FormatTagHelperAssemblyCouldNotBeResolved(parsed.AssemblyName), + parsed.AssemblyName.Length); + + // Skip this one, it's an error + break; + } + + for (var j = 0; j < tagHelpers.Count; j++) + { + var tagHelper = tagHelpers[j]; + if (MatchesDirective(tagHelper, parsed)) + { + matches.Add(tagHelper); + } + } + + break; + + case TagHelperDirectiveType.RemoveTagHelper: + + parsed = ParseAddOrRemoveDirective(directive, errorSink); + if (parsed == null) + { + // Skip this one, it's an error + break; + } + + + if (!AssemblyContainsTagHelpers(parsed.AssemblyName, tagHelpers)) + { + errorSink.OnError( + parsed.AssemblyNameLocation, + Resources.FormatTagHelperAssemblyCouldNotBeResolved(parsed.AssemblyName), + parsed.AssemblyName.Length); + + // Skip this one, it's an error + break; + } + + for (var j = 0; j < tagHelpers.Count; j++) + { + var tagHelper = tagHelpers[j]; + if (MatchesDirective(tagHelper, parsed)) + { + matches.Remove(tagHelper); + } + } + + break; + + case TagHelperDirectiveType.TagHelperPrefix: + + // We only expect to see a single one of these per file, but that's enforced at another level. + prefixDirective = directive; + + break; + } + } + + var prefix = prefixDirective?.DirectiveText; + if (prefix != null && !IsValidTagHelperPrefix(prefix, prefixDirective.Location, errorSink)) + { + prefix = null; + } + + return PrefixDescriptors(prefix, matches); + } + + private bool AssemblyContainsTagHelpers(string assemblyName, IReadOnlyList tagHelpers) + { + for (var i = 0; i < tagHelpers.Count; i++) + { + if (string.Equals(tagHelpers[i].AssemblyName, assemblyName, StringComparison.Ordinal)) + { + return true; + } + } + + return false; + } + + // Internal for testing + internal ParsedDirective ParseAddOrRemoveDirective(TagHelperDirectiveDescriptor directive, ErrorSink errorSink) + { + var text = directive.DirectiveText; + var lookupStrings = text?.Split(new[] { ',' }); + + // Ensure that we have valid lookupStrings to work with. The valid format is "typeName, assemblyName" + if (lookupStrings == null || + lookupStrings.Any(string.IsNullOrWhiteSpace) || + lookupStrings.Length != 2) + { + errorSink.OnError( + directive.Location, + Resources.FormatInvalidTagHelperLookupText(text), + Math.Max(text.Length, 1)); + + return null; + } + + var trimmedAssemblyName = lookupStrings[1].Trim(); + + // + 1 is for the comma separator in the lookup text. + var assemblyNameIndex = + lookupStrings[0].Length + 1 + lookupStrings[1].IndexOf(trimmedAssemblyName, StringComparison.Ordinal); + var assemblyNamePrefix = directive.DirectiveText.Substring(0, assemblyNameIndex); + var assemblyNameLocation = new SourceLocation( + directive.Location.FilePath, + directive.Location.AbsoluteIndex + assemblyNameIndex, + directive.Location.LineIndex, + directive.Location.CharacterIndex + assemblyNameIndex); + + return new ParsedDirective + { + TypePattern = lookupStrings[0].Trim(), + AssemblyName = trimmedAssemblyName, + AssemblyNameLocation = assemblyNameLocation, + }; + } + + // Internal for testing + internal bool IsValidTagHelperPrefix( + string prefix, + SourceLocation directiveLocation, + ErrorSink errorSink) + { + foreach (var character in prefix) + { + // Prefixes are correlated with tag names, tag names cannot have whitespace. + if (char.IsWhiteSpace(character) || InvalidNonWhitespaceNameCharacters.Contains(character)) + { + errorSink.OnError( + directiveLocation, + Resources.FormatInvalidTagHelperPrefixValue( + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + character, + prefix), + prefix.Length); + + return false; + } + } + + return true; + } + + private static IReadOnlyList PrefixDescriptors( + string prefix, + IEnumerable descriptors) + { + if (!string.IsNullOrEmpty(prefix)) + { + return descriptors.Select(descriptor => new TagHelperDescriptor(descriptor) + { + Prefix = prefix + }).ToList(); + } + + return descriptors.ToList(); + } + + private static bool MatchesDirective(TagHelperDescriptor descriptor, ParsedDirective lookupInfo) + { + if (!string.Equals(descriptor.AssemblyName, lookupInfo.AssemblyName, StringComparison.Ordinal)) + { + return false; + } + + if (lookupInfo.TypePattern.EndsWith("*", StringComparison.Ordinal)) + { + if (lookupInfo.TypePattern.Length == 1) + { + // TypePattern is "*". + return true; + } + + var lookupTypeName = lookupInfo.TypePattern.Substring(0, lookupInfo.TypePattern.Length - 1); + + return descriptor.TypeName.StartsWith(lookupTypeName, StringComparison.Ordinal); + } + + return string.Equals(descriptor.TypeName, lookupInfo.TypePattern, StringComparison.Ordinal); + } + + private static int GetErrorLength(string directiveText) + { + var nonNullLength = directiveText == null ? 1 : directiveText.Length; + var normalizeEmptyStringLength = Math.Max(nonNullLength, 1); + + return normalizeEmptyStringLength; + } + private IReadOnlyList CombineErrors(IReadOnlyList errors1, IReadOnlyList errors2) { var combinedErrors = new List(errors1.Count + errors2.Count); @@ -79,7 +308,16 @@ namespace Microsoft.AspNetCore.Razor.Evolution return combinedErrors; } - private class Visitor : ParserVisitor + internal class ParsedDirective + { + public string AssemblyName { get; set; } + + public string TypePattern { get; set; } + + public SourceLocation AssemblyNameLocation { get; set; } + } + + private class DirectiveVisitor : ParserVisitor { public List Directives { get; } = new List(); diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs index 09c8a49a85..bca7004242 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Evolution.Intermediate; -using Microsoft.AspNetCore.Razor.Evolution.Legacy; using Xunit; using Xunit.Sdk; @@ -1451,21 +1450,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests AssertDesignTimeDocumentMatchBaseline(document); } - private class TestTagHelperDescriptorResolver : ITagHelperDescriptorResolver - { - private readonly IEnumerable _descriptors; - - public TestTagHelperDescriptorResolver(IEnumerable descriptors) - { - _descriptors = descriptors; - } - - public IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext) - { - return _descriptors; - } - } - private class ApiSetsIRTestAdapter : RazorIRPassBase { public override int Order => RazorIRPass.LoweringOrder; diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/InstrumentationPassIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/InstrumentationPassIntegrationTest.cs index c60e6cca85..53c2ace676 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/InstrumentationPassIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/InstrumentationPassIntegrationTest.cs @@ -16,17 +16,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests new TagHelperDescriptor { TagName = "p", - TypeName = "PTagHelper" + TypeName = "PTagHelper", + AssemblyName = "TestAssembly", }, new TagHelperDescriptor { TagName = "form", - TypeName = "FormTagHelper" + TypeName = "FormTagHelper", + AssemblyName = "TestAssembly", }, new TagHelperDescriptor { TagName = "input", TypeName = "InputTagHelper", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TagHelpersIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TagHelpersIntegrationTest.cs index 9b07981b8f..b3292094fd 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TagHelpersIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TagHelpersIntegrationTest.cs @@ -16,7 +16,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests new TagHelperDescriptor { TagName = "input", - TypeName = "InputTagHelper" + TypeName = "InputTagHelper", + AssemblyName = "TestAssembly", } }; @@ -40,6 +41,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "InputTagHelper", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor { Name = "bound", @@ -68,17 +70,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests new TagHelperDescriptor { TagName = "p", - TypeName = "PTagHelper" + TypeName = "PTagHelper", + AssemblyName = "TestAssembly", }, new TagHelperDescriptor { TagName = "form", - TypeName = "FormTagHelper" + TypeName = "FormTagHelper", + AssemblyName = "TestAssembly", }, new TagHelperDescriptor { TagName = "input", TypeName = "InputTagHelper", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor { Name = "value", diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs index ece8ceee6c..685ab9e5a8 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Evolution.Legacy; namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { @@ -24,17 +22,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests new TagHelperDescriptor { TagName = "span", - TypeName = "SpanTagHelper" + TypeName = "SpanTagHelper", + AssemblyName = "TestAssembly", }, new TagHelperDescriptor { TagName = "div", - TypeName = "DivTagHelper" + TypeName = "DivTagHelper", + AssemblyName = "TestAssembly", }, new TagHelperDescriptor { TagName = "input", TypeName = "InputTagHelper", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -68,7 +69,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "a", TypeName = "TestNamespace.ATagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor @@ -84,7 +85,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "a", TypeName = "TestNamespace.ATagHelperMultipleSelectors", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor @@ -107,7 +108,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -127,7 +128,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper2", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -145,7 +146,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor @@ -161,7 +162,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper2", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor @@ -185,7 +186,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -201,7 +202,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -227,7 +228,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -283,7 +284,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -303,7 +304,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -341,7 +342,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -369,7 +370,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -381,7 +382,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -393,7 +394,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -405,7 +406,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -429,14 +430,14 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "p", TypeName = "TestNamespace.PTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "class" } }, }, new TagHelperDescriptor { TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo) @@ -447,7 +448,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper2", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), @@ -463,7 +464,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "*", TypeName = "TestNamespace.CatchAllTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "catchAll" } }, } }; @@ -480,7 +481,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper1", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -529,7 +530,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { TagName = "input", TypeName = "TestNamespace.InputTagHelper2", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new[] { new TagHelperAttributeDescriptor @@ -578,7 +579,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests Prefix = prefix, TagName = "p", TypeName = "TestNamespace.PTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("age", pAgePropertyInfo) @@ -590,7 +591,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests Prefix = prefix, TagName = "input", TypeName = "TestNamespace.InputTagHelper", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo) @@ -602,7 +603,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests Prefix = prefix, TagName = "input", TypeName = "TestNamespace.InputTagHelper2", - AssemblyName = "SomeAssembly", + AssemblyName = "TestAssembly", Attributes = new TagHelperAttributeDescriptor[] { new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRLoweringPhaseIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRLoweringPhaseIntegrationTest.cs index 4248764d0f..2642af452c 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRLoweringPhaseIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRLoweringPhaseIntegrationTest.cs @@ -156,13 +156,15 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate public void Lower_TagHelpers() { // Arrange - var codeDocument = TestRazorCodeDocument.Create(@""); + var codeDocument = TestRazorCodeDocument.Create(@"@addTagHelper *, TestAssembly +"); var tagHelpers = new[] { new TagHelperDescriptor { TagName = "span", - TypeName = "SpanTagHelper" + TypeName = "SpanTagHelper", + AssemblyName = "TestAssembly", } }; @@ -196,17 +198,22 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate public void Lower_TagHelpersWithBoundAttribute() { // Arrange - var codeDocument = TestRazorCodeDocument.Create(""); + var codeDocument = TestRazorCodeDocument.Create(@"@addTagHelper *, TestAssembly +"); var descriptor = new TagHelperDescriptor { TagName = "input", TypeName = "InputTagHelper", - Attributes = new[] { new TagHelperAttributeDescriptor + AssemblyName = "TestAssembly", + Attributes = new[] { - Name = "bound", - PropertyName = "FooProp", - TypeName = "System.String" - } } + new TagHelperAttributeDescriptor + { + Name = "bound", + PropertyName = "FooProp", + TypeName = "System.String" + } + } }; // Act @@ -349,20 +356,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate return irDocument; } - - private class TestTagHelperDescriptorResolver : ITagHelperDescriptorResolver - { - private readonly IEnumerable _descriptors; - - public TestTagHelperDescriptorResolver(IEnumerable descriptors) - { - _descriptors = descriptors; - } - - public IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext) - { - return _descriptors; - } - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineBuilderExtensions.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineBuilderExtensions.cs index edc2769c33..b2cf919a28 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineBuilderExtensions.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineBuilderExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Razor.Evolution.Legacy; -using System.Collections.Generic; using System.Linq; namespace Microsoft.AspNetCore.Razor.Evolution @@ -21,15 +19,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution resolver.TagHelpers.AddRange(tagHelpers); return builder; } - - private class TestTagHelperDescriptorResolver : ITagHelperDescriptorResolver - { - public List TagHelpers { get; } = new List(); - - public IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext) - { - return TagHelpers; - } - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TagHelperBinderSyntaxTreePassTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TagHelperBinderSyntaxTreePassTest.cs index 52bb9ed4f6..9b48ad700d 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TagHelperBinderSyntaxTreePassTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TagHelperBinderSyntaxTreePassTest.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; -using System.Linq; using Microsoft.AspNetCore.Razor.Evolution.Legacy; using Xunit; +using System.Linq; namespace Microsoft.AspNetCore.Razor.Evolution { @@ -17,25 +17,26 @@ namespace Microsoft.AspNetCore.Razor.Evolution // Arrange var engine = RazorEngine.Create(builder => { - var descriptors = new[] + builder.AddTagHelpers(new[] { new TagHelperDescriptor { + AssemblyName = "TestAssembly", TagName = "form", }, new TagHelperDescriptor { + AssemblyName = "TestAssembly", TagName = "input", } - }; - var resolver = new TestTagHelperDescriptorResolver(descriptors); - var tagHelperFeature = new TagHelperFeature(resolver); - builder.Features.Add(tagHelperFeature); + }); }); + var pass = new TagHelperBinderSyntaxTreePass() { Engine = engine, }; + var sourceDocument = CreateTestSourceDocument(); var codeDocument = RazorCodeDocument.Create(sourceDocument); var originalTree = RazorSyntaxTree.Parse(sourceDocument); @@ -106,15 +107,18 @@ namespace Microsoft.AspNetCore.Razor.Evolution // Arrange var engine = RazorEngine.Create(builder => { - var resolver = new TestTagHelperDescriptorResolver(descriptors: Enumerable.Empty()); + var resolver = new TestTagHelperDescriptorResolver(); var tagHelperFeature = new TagHelperFeature(resolver); builder.Features.Add(tagHelperFeature); }); + var pass = new TagHelperBinderSyntaxTreePass() { Engine = engine, }; - var sourceDocument = CreateTestSourceDocument(); + + // No taghelper directives here so nothing is resolved. + var sourceDocument = TestRazorSourceDocument.Create("Hello, world"); var codeDocument = RazorCodeDocument.Create(sourceDocument); var originalTree = RazorSyntaxTree.Parse(sourceDocument); @@ -126,6 +130,41 @@ namespace Microsoft.AspNetCore.Razor.Evolution Assert.Same(originalTree, outputTree); } + [Fact] + public void Execute_AddsErrorWhenNoTagHelpersAreFoundInAssembly() + { + // Arrange + var engine = RazorEngine.Create(builder => + { + var resolver = new TestTagHelperDescriptorResolver(); + var tagHelperFeature = new TagHelperFeature(resolver); + builder.Features.Add(tagHelperFeature); + }); + + var pass = new TagHelperBinderSyntaxTreePass() + { + Engine = engine, + }; + + var sourceDocument = CreateTestSourceDocument(); + var codeDocument = RazorCodeDocument.Create(sourceDocument); + var originalTree = RazorSyntaxTree.Parse(sourceDocument); + + var expectedError = new RazorError( + Resources.FormatTagHelperAssemblyCouldNotBeResolved("TestAssembly"), + new SourceLocation(Environment.NewLine.Length + 17, 1, 1), + length: 12); + + // Act + var outputTree = pass.Execute(codeDocument, originalTree); + + // Assert + Assert.Same(originalTree.Root, outputTree.Root); + + var error = Assert.Single(outputTree.Diagnostics); + Assert.Equal(expectedError, error); + } + [Fact] public void Execute_RecreatesSyntaxTreeOnResolverErrors() { @@ -137,13 +176,16 @@ namespace Microsoft.AspNetCore.Razor.Evolution var tagHelperFeature = new TagHelperFeature(resolver); builder.Features.Add(tagHelperFeature); }); + var pass = new TagHelperBinderSyntaxTreePass() { Engine = engine, }; + var sourceDocument = CreateTestSourceDocument(); var codeDocument = RazorCodeDocument.Create(sourceDocument); var originalTree = RazorSyntaxTree.Parse(sourceDocument); + var initialError = new RazorError("Initial test error", SourceLocation.Zero, length: 1); var erroredOriginalTree = RazorSyntaxTree.Create( originalTree.Root, @@ -166,25 +208,26 @@ namespace Microsoft.AspNetCore.Razor.Evolution // Arrange var engine = RazorEngine.Create(builder => { - var descriptors = new[] + builder.AddTagHelpers(new[] { new TagHelperDescriptor { TagName = "form", + AssemblyName= "TestAssembly", }, new TagHelperDescriptor { TagName = "input", + AssemblyName= "TestAssembly", } - }; - var resolver = new TestTagHelperDescriptorResolver(descriptors); - var tagHelperFeature = new TagHelperFeature(resolver); - builder.Features.Add(tagHelperFeature); + }); }); + var pass = new TagHelperBinderSyntaxTreePass() { Engine = engine, }; + var content = @" @addTagHelper *, TestAssembly @@ -192,12 +235,15 @@ namespace Microsoft.AspNetCore.Razor.Evolution "; var sourceDocument = TestRazorSourceDocument.Create(content); var codeDocument = RazorCodeDocument.Create(sourceDocument); + var originalTree = RazorSyntaxTree.Parse(sourceDocument); + var initialError = new RazorError("Initial test error", SourceLocation.Zero, length: 1); var expectedRewritingError = new RazorError( LegacyResources.FormatTagHelpersParseTreeRewriter_FoundMalformedTagHelper("form"), new SourceLocation(Environment.NewLine.Length * 2 + 30, 2, 1), length: 4); + var erroredOriginalTree = RazorSyntaxTree.Create(originalTree.Root, originalTree.Source, new[] { initialError }, originalTree.Options); // Act @@ -209,6 +255,970 @@ namespace Microsoft.AspNetCore.Razor.Evolution Assert.Equal(new[] { initialError, expectedRewritingError }, outputTree.Diagnostics); } + [Theory] + [InlineData("foo,assemblyName", 4)] + [InlineData("foo, assemblyName", 5)] + [InlineData(" foo, assemblyName", 8)] + [InlineData(" foo , assemblyName", 11)] + [InlineData("foo, assemblyName", 8)] + [InlineData(" foo , assemblyName ", 14)] + public void ParseAddOrRemoveDirective_CalculatesAssemblyLocationInLookupText(string text, int assemblyLocation) + { + // Arrange + var errorSink = new ErrorSink(); + var pass = new TagHelperBinderSyntaxTreePass(); + + var directive = new TagHelperDirectiveDescriptor() + { + DirectiveText = text, + DirectiveType = TagHelperDirectiveType.AddTagHelper, + Location = SourceLocation.Zero, + }; + + var expected = new SourceLocation(assemblyLocation, 0, assemblyLocation); + + // Act + var result = pass.ParseAddOrRemoveDirective(directive, errorSink); + + // Assert + Assert.Empty(errorSink.Errors); + Assert.Equal("foo", result.TypePattern); + Assert.Equal("assemblyName", result.AssemblyName); + Assert.Equal(expected, result.AssemblyNameLocation); + } + + public static TheoryData InvalidTagHelperPrefixData + { + get + { + var directiveLocation1 = new SourceLocation(1, 2, 3); + var directiveLocation2 = new SourceLocation(4, 5, 6); + + var invalidTagHelperPrefixValueError = + "Invalid tag helper directive '{0}' value. '{1}' is not allowed in prefix '{2}'."; + + return new TheoryData, IEnumerable> + { + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "th ", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + }, + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + ' ', + "th "), + directiveLocation1, + length: 3) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "th\t", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + '\t', + "th\t"), + directiveLocation1, + length: 3) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "th" + Environment.NewLine, + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + Environment.NewLine[0], + "th" + Environment.NewLine), + directiveLocation1, + length: 2 + Environment.NewLine.Length) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = " th ", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + ' ', + " th "), + directiveLocation1, + length: 4) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "@", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + '@', + "@"), + directiveLocation1, + length: 1) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "t@h", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + '@', + "t@h"), + directiveLocation1, + length: 3) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "!", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + '!', + "!"), + directiveLocation1, + length: 1) + } + }, + { + new[] + { + new TagHelperDirectiveDescriptor + { + DirectiveText = "!th", + Location = directiveLocation1, + DirectiveType = TagHelperDirectiveType.TagHelperPrefix + } + }, + new[] + { + new RazorError( + string.Format( + invalidTagHelperPrefixValueError, + SyntaxConstants.CSharp.TagHelperPrefixKeyword, + '!', + "!th"), + directiveLocation1, + length: 3) + } + }, + }; + } + } + + [Theory] + [MemberData(nameof(InvalidTagHelperPrefixData))] + public void IsValidTagHelperPrefix_ValidatesPrefix( + object directives, + object expectedErrors) + { + // Arrange + var errorSink = new ErrorSink(); + + var pass = new TagHelperBinderSyntaxTreePass(); + + // Act + foreach (var directive in ((IEnumerable)directives)) + { + Assert.False(pass.IsValidTagHelperPrefix(directive.DirectiveText, directive.Location, errorSink)); + } + + // Assert + Assert.Equal(((IEnumerable)expectedErrors).ToArray(), errorSink.Errors.ToArray()); + } + + private static string AssemblyA => "TestAssembly"; + + private static string AssemblyB => "AnotherAssembly"; + + private static TagHelperDescriptor Valid_PlainTagHelperDescriptor + { + get + { + return new TagHelperDescriptor + { + TagName = "valid_plain", + TypeName = "Microsoft.AspNetCore.Razor.TagHelpers.ValidPlainTagHelper", + AssemblyName = AssemblyA, + }; + } + } + + private static TagHelperDescriptor Valid_InheritedTagHelperDescriptor + { + get + { + return new TagHelperDescriptor + { + TagName = "valid_inherited", + TypeName = "Microsoft.AspNetCore.Razor.TagHelpers.ValidInheritedTagHelper", + AssemblyName = AssemblyA + }; + } + } + + private static TagHelperDescriptor[] AllTagHelpers => new[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + String_TagHelperDescriptor + }; + + private static TagHelperDescriptor String_TagHelperDescriptor + { + get + { + // We're treating 'string' as a TagHelper so we can test TagHelpers in multiple assemblies without + // building a separate assembly with a single TagHelper. + return new TagHelperDescriptor + { + TagName = "string", + TypeName = "System.String", + AssemblyName = AssemblyB, + }; + } + } + + public static TheoryData ProcessDirectives_TagHelperPrefixData + { + get + { + return new TheoryData< + IEnumerable, // tagHelpers + IEnumerable, // directiveDescriptors + IEnumerable> // expectedDescriptors + { + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor("", TagHelperDirectiveType.TagHelperPrefix), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidPlain*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor("th:", TagHelperDirectiveType.TagHelperPrefix), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidPlain*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + }, + new [] { CreatePrefixedValidPlainDescriptor("th:") } + }, + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("th:", TagHelperDirectiveType.TagHelperPrefix) + }, + new [] + { + CreatePrefixedValidPlainDescriptor("th:"), + CreatePrefixedValidInheritedDescriptor("th:") + } + }, + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor("th-", TagHelperDirectiveType.TagHelperPrefix), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidPlain*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidInherited*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper) + }, + new [] + { + CreatePrefixedValidPlainDescriptor("th-"), + CreatePrefixedValidInheritedDescriptor("th-") + } + }, + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor("", TagHelperDirectiveType.TagHelperPrefix), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidPlain*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidInherited*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor } + }, + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor("th", TagHelperDirectiveType.TagHelperPrefix), + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyB, + TagHelperDirectiveType.AddTagHelper), + }, + new [] + { + CreatePrefixedValidPlainDescriptor("th"), + CreatePrefixedValidInheritedDescriptor("th"), + CreatePrefixedStringDescriptor("th") + } + }, + { + AllTagHelpers, + new [] + { + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("th:-", TagHelperDirectiveType.TagHelperPrefix), + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyB, + TagHelperDirectiveType.AddTagHelper), + }, + new [] + { + CreatePrefixedValidPlainDescriptor("th:-"), + CreatePrefixedValidInheritedDescriptor("th:-"), + CreatePrefixedStringDescriptor("th:-") + } + }, + }; + } + } + + [Theory] + [MemberData(nameof(ProcessDirectives_TagHelperPrefixData))] + public void ProcessDirectives_AppliesDirectives_WithTagHelperPrefix( + object tagHelpers, + object directiveDescriptors, + object expectedDescriptors) + { + // Arrange + var errorSink = new ErrorSink(); + var pass = new TagHelperBinderSyntaxTreePass(); + + var expected = (IEnumerable)expectedDescriptors; + + // Act + var results = pass.ProcessDirectives( + ((IEnumerable)directiveDescriptors).ToArray(), + ((IEnumerable)tagHelpers).ToArray(), + errorSink); + + // Assert + Assert.Empty(errorSink.Errors); + Assert.Equal(expected.Count(), results.Count()); + + foreach (var expectedDescriptor in expected) + { + Assert.Contains(expectedDescriptor, results, TagHelperDescriptorComparer.Default); + } + } + + public static TheoryData ProcessDirectivesData + { + get + { + return new TheoryData, // tagHelpers + IEnumerable, // directiveDescriptors + IEnumerable> // expectedDescriptors + { + { + new [] { Valid_PlainTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, String_TagHelperDescriptor }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor, String_TagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, String_TagHelperDescriptor }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, String_TagHelperDescriptor }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] { String_TagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor( + Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, + TagHelperDirectiveType.RemoveTagHelper) + }, + new [] { Valid_InheritedTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, + TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_InheritedTagHelperDescriptor, Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + }, + new [] { Valid_InheritedTagHelperDescriptor, Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidPlain*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.*, " + AssemblyA, + TagHelperDirectiveType.AddTagHelper), + }, + new [] { Valid_PlainTagHelperDescriptor, Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "Microsoft.AspNetCore.Razor.TagHelpers.ValidP*, " + AssemblyA, + TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_InheritedTagHelperDescriptor, Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, String_TagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("Str*, " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, String_TagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, String_TagHelperDescriptor, }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("System." + String_TagHelperDescriptor.TypeName + ", " + AssemblyB, TagHelperDirectiveType.AddTagHelper) + }, + new [] { Valid_PlainTagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, String_TagHelperDescriptor }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("Microsoft.*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] { String_TagHelperDescriptor } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, String_TagHelperDescriptor }, + new [] + { + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "?Microsoft*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor( + "System." + String_TagHelperDescriptor.TypeName + ", " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] + { + Valid_InheritedTagHelperDescriptor, + Valid_PlainTagHelperDescriptor, + String_TagHelperDescriptor + } + }, + { + new [] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor, String_TagHelperDescriptor }, + new [] + { + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor( + "TagHelper*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor( + "System." + String_TagHelperDescriptor.TypeName + ", " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + }, + new [] + { + Valid_InheritedTagHelperDescriptor, + Valid_PlainTagHelperDescriptor, + String_TagHelperDescriptor + } + }, + }; + } + } + + [Theory] + [MemberData(nameof(ProcessDirectivesData))] + public void ProcessDirectives_FiltersTagHelpersByDirectives( + object tagHelpers, + object directiveDescriptors, + object expectedDescriptors) + { + // Arrange + var errorSink = new ErrorSink(); + + var pass = new TagHelperBinderSyntaxTreePass(); + + var expected = (IEnumerable)expectedDescriptors; + + // Act + var results = pass.ProcessDirectives( + new List((IEnumerable)directiveDescriptors), + new List((IEnumerable)tagHelpers), + errorSink); + + // Assert + Assert.Empty(errorSink.Errors); + Assert.Equal(expected.Count(), results.Count()); + + foreach (var expectedDescriptor in expected) + { + Assert.Contains(expectedDescriptor, results, TagHelperDescriptorComparer.Default); + } + } + + public static TheoryData ProcessDirectives_EmptyResultData + { + get + { + return new TheoryData, IEnumerable> + { + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_InheritedTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + String_TagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + String_TagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_InheritedTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor(String_TagHelperDescriptor.TypeName + ", " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + } + }, + { + new TagHelperDescriptor[0], + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("Mic*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor + }, + new [] + { + CreateTagHelperDirectiveDescriptor("Mic*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_PlainTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor(Valid_InheritedTagHelperDescriptor.TypeName + ", " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper) + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + String_TagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("Microsoft.*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("System.*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("Microsoft.AspNetCore.Razor.TagHelpers*, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor("System.*, " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + String_TagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("?icrosoft.*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("?ystem.*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("*?????r, " + AssemblyA, TagHelperDirectiveType.RemoveTagHelper), + CreateTagHelperDirectiveDescriptor("Sy??em.*, " + AssemblyB, TagHelperDirectiveType.RemoveTagHelper) + } + }, + { + new TagHelperDescriptor[] + { + Valid_PlainTagHelperDescriptor, + Valid_InheritedTagHelperDescriptor, + String_TagHelperDescriptor, + }, + new [] + { + CreateTagHelperDirectiveDescriptor("?i?crosoft.*, " + AssemblyA, TagHelperDirectiveType.AddTagHelper), + CreateTagHelperDirectiveDescriptor("??ystem.*, " + AssemblyB, TagHelperDirectiveType.AddTagHelper), + } + }, + }; + } + } + + [Theory] + [MemberData(nameof(ProcessDirectives_EmptyResultData))] + public void ProcessDirectives_CanReturnEmptyDescriptorsBasedOnDirectiveDescriptors( + object tagHelpers, + object directiveDescriptors) + { + // Arrange + var errorSink = new ErrorSink(); + + var pass = new TagHelperBinderSyntaxTreePass(); + + // Act + var results = pass.ProcessDirectives( + new List((IEnumerable)directiveDescriptors), + new List((IEnumerable)tagHelpers), + errorSink); + + // Assert + Assert.Empty(results); + } + + public static TheoryData ProcessDirectives_IgnoresSpacesData + { + get + { + var assemblyName = Valid_PlainTagHelperDescriptor.AssemblyName; + var typeName = Valid_PlainTagHelperDescriptor.TypeName; + return new TheoryData + { + $"{typeName},{assemblyName}", + $" {typeName},{assemblyName}", + $"{typeName} ,{assemblyName}", + $" {typeName} ,{assemblyName}", + $"{typeName}, {assemblyName}", + $"{typeName},{assemblyName} ", + $"{typeName}, {assemblyName} ", + $" {typeName}, {assemblyName} ", + $" {typeName} , {assemblyName} " + }; + } + } + + [Theory] + [MemberData(nameof(ProcessDirectives_IgnoresSpacesData))] + public void ProcessDirectives_IgnoresSpaces(string directiveText) + { + // Arrange + var errorSink = new ErrorSink(); + var pass = new TagHelperBinderSyntaxTreePass(); + + var directives = new[] + { + new TagHelperDirectiveDescriptor() + { + DirectiveText = directiveText, + DirectiveType = TagHelperDirectiveType.AddTagHelper, + } + }; + + // Act + var results = pass.ProcessDirectives( + directives, + new[] { Valid_PlainTagHelperDescriptor, Valid_InheritedTagHelperDescriptor }, + errorSink); + + // Assert + Assert.Empty(errorSink.Errors); + + var single = Assert.Single(results); + Assert.Equal(Valid_PlainTagHelperDescriptor, single, TagHelperDescriptorComparer.Default); + } + + [Theory] + [InlineData("", 1)] + [InlineData("*,", 2)] + [InlineData("?,", 2)] + [InlineData(",", 1)] + [InlineData(",,,", 3)] + [InlineData("First, ", 7)] + [InlineData("First , ", 8)] + [InlineData(" ,Second", 8)] + [InlineData(" , Second", 9)] + [InlineData("SomeType,", 9)] + [InlineData("SomeAssembly", 12)] + [InlineData("First,Second,Third", 18)] + public void DescriptorResolver_CreatesErrorIfInvalidLookupText_DoesNotThrow(string directiveText, int errorLength) + { + // Arrange + var errorSink = new ErrorSink(); + var pass = new TagHelperBinderSyntaxTreePass(); + + var directive = new TagHelperDirectiveDescriptor() + { + DirectiveText = directiveText, + DirectiveType = TagHelperDirectiveType.AddTagHelper, + Location = new SourceLocation(1, 2, 3), + }; + + var expectedErrorMessage = string.Format( + "Invalid tag helper directive look up text '{0}'. The correct look up text " + + "format is: \"typeName, assemblyName\".", + directiveText); + + // Act + var result = pass.ParseAddOrRemoveDirective(directive, errorSink); + + // Assert + Assert.Null(result); + + var error = Assert.Single(errorSink.Errors); + Assert.Equal(errorLength, error.Length); + Assert.Equal(new SourceLocation(1, 2, 3), error.Location); + Assert.Equal(expectedErrorMessage, error.Message); + } + + private static TagHelperDescriptor CreatePrefixedValidPlainDescriptor(string prefix) + { + return new TagHelperDescriptor(Valid_PlainTagHelperDescriptor) + { + Prefix = prefix, + }; + } + + private static TagHelperDescriptor CreatePrefixedValidInheritedDescriptor(string prefix) + { + return new TagHelperDescriptor(Valid_InheritedTagHelperDescriptor) + { + Prefix = prefix, + }; + } + + private static TagHelperDescriptor CreatePrefixedStringDescriptor(string prefix) + { + return new TagHelperDescriptor(String_TagHelperDescriptor) + { + Prefix = prefix, + }; + } + + private static TagHelperDirectiveDescriptor CreateTagHelperDirectiveDescriptor( + string directiveText, + TagHelperDirectiveType directiveType) + { + return new TagHelperDirectiveDescriptor + { + DirectiveText = directiveText, + Location = SourceLocation.Zero, + DirectiveType = directiveType + }; + } + private static RazorSourceDocument CreateTestSourceDocument() { var content = @@ -221,21 +1231,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution return sourceDocument; } - private class TestTagHelperDescriptorResolver : ITagHelperDescriptorResolver - { - private readonly IEnumerable _descriptors; - - public TestTagHelperDescriptorResolver(IEnumerable descriptors) - { - _descriptors = descriptors; - } - - public IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext) - { - return _descriptors; - } - } - private class ErrorLoggingTagHelperDescriptorResolver : ITagHelperDescriptorResolver { private readonly RazorError _error; @@ -245,11 +1240,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution _error = error; } - public IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext) + public IEnumerable Resolve(ErrorSink errorSink) { - resolutionContext.ErrorSink.OnError(_error); + errorSink.OnError(_error); - return Enumerable.Empty(); + return new[] { new TagHelperDescriptor() { AssemblyName = "TestAssembly" } }; } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml index 924029743e..10b53aaeaf 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml @@ -1 +1 @@ -@addTagHelper something, nice \ No newline at end of file +@addTagHelper "*, TestAssembly" diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml index 0b7f7f0092..8610fe90aa 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper *, something +@addTagHelper *, TestAssembly

HelloWorld

diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt index 732ed9edf8..dc1274ce9b 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt @@ -1,9 +1,9 @@ -Source Location: (184:5,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) +Source Location: (187:5,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| Generated Location: (1565:25,42 [4] ) |true| -Source Location: (230:6,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) +Source Location: (233:6,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| Generated Location: (2218:35,42 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs index 92bb0332f2..698b2d934b 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6c8b55df08e7538ff6155a5bc3b8135b305ad08a" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ea06819774d4f892a37cc84688446440dee29bd6" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml index fb0515d0a3..b58b6b44ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper "something, nice" +@addTagHelper "*, TestAssembly"

diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml index 73e9407a3d..089363600c 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml @@ -1,5 +1,5 @@ @tagHelperPrefix "THS" -@addTagHelper something, nice +@addTagHelper "*, TestAssembly" diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt index 021a95c7fc..8faba76d1f 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt @@ -1,4 +1,4 @@ -Source Location: (224:7,43 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) +Source Location: (226:7,43 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |true| Generated Location: (1350:23,43 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs index c6a0cea7e2..ef904ba40b 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "859f448778119fd3043b1f19ea3d1f695558d6a6" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e05d346bc9435e651c4c8f34515c1b5f2cff294a" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml index b8b5bcbf73..56ac77231a 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly" @removeTagHelper "doesntmatter, nice"

diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs index 7433fd3d21..e24809dc13 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "02f53fe4a386cdc0885235e5fd3f5d6d317dd4d6" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "56c40717284b82fcb2ee9f60f09e8c6c0bda8959" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml index e14e76dbb0..10124f06fa 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly" @if (true) { diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt index f954d7a8b4..d940e481e4 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt @@ -1,4 +1,4 @@ -Source Location: (34:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if (true) { var checkbox = "checkbox"; @@ -11,7 +11,7 @@ Generated Location: (934:19,1 [52] ) | -Source Location: (222:9,13 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (224:9,13 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if (false) { | @@ -20,7 +20,7 @@ Generated Location: (1126:28,13 [43] ) { | -Source Location: (348:11,99 [66] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (350:11,99 [66] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | } else @@ -33,193 +33,193 @@ Generated Location: (1846:40,99 [66] ) { | -Source Location: (444:15,46 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (446:15,46 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checkbox| Generated Location: (2296:51,49 [8] ) |checkbox| -Source Location: (461:15,63 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (463:15,63 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true| Generated Location: (2649:58,63 [4] ) |true| -Source Location: (472:15,74 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (474:15,74 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | Generated Location: (2950:64,74 [18] ) | | -Source Location: (505:16,31 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (507:16,31 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true ? "checkbox" : "anything"| Generated Location: (3337:72,34 [30] ) |true ? "checkbox" : "anything"| -Source Location: (540:16,66 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (542:16,66 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | Generated Location: (3715:79,66 [18] ) | | -Source Location: (572:17,30 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (574:17,30 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if(true) { | Generated Location: (4098:87,30 [11] ) |if(true) { | -Source Location: (604:17,62 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (606:17,62 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | } else { | Generated Location: (4298:92,62 [10] ) | } else { | -Source Location: (635:17,93 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (637:17,93 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| Generated Location: (4528:97,93 [2] ) | }| -Source Location: (639:17,97 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (641:17,97 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| Generated Location: (4908:104,97 [15] ) | }| -Source Location: (161:7,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (163:7,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTime.Now| Generated Location: (5179:111,35 [12] ) |DateTime.Now| -Source Location: (781:21,14 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (783:21,14 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | var @object = false;| Generated Location: (5333:116,14 [21] ) | var @object = false;| -Source Location: (834:22,29 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (836:22,29 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| Generated Location: (5731:123,42 [1] ) |(| -Source Location: (835:22,30 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (837:22,30 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@object| Generated Location: (5732:123,43 [7] ) |@object| -Source Location: (842:22,37 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (844:22,37 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| Generated Location: (5739:123,50 [1] ) |)| -Source Location: (709:20,39 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (711:20,39 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year| Generated Location: (6001:129,38 [23] ) |DateTimeOffset.Now.Year| -Source Location: (732:20,62 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (734:20,62 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | - 1970| Generated Location: (6024:129,61 [7] ) | - 1970| -Source Location: (974:25,61 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (976:25,61 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| Generated Location: (6427:136,60 [1] ) |(| -Source Location: (975:25,62 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (977:25,62 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| Generated Location: (6428:136,61 [30] ) |DateTimeOffset.Now.Year > 2014| -Source Location: (1005:25,92 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1007:25,92 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| Generated Location: (6458:136,91 [1] ) |)| -Source Location: (877:24,16 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (879:24,16 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |-1970 + | Generated Location: (6715:142,33 [8] ) |-1970 + | -Source Location: (885:24,24 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (887:24,24 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| Generated Location: (6723:142,41 [1] ) |@| -Source Location: (886:24,25 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (888:24,25 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year| Generated Location: (6724:142,42 [23] ) |DateTimeOffset.Now.Year| -Source Location: (1104:28,28 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1106:28,28 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| Generated Location: (7125:149,42 [30] ) |DateTimeOffset.Now.Year > 2014| -Source Location: (1042:27,16 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1044:27,16 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year - 1970| Generated Location: (7411:155,33 [30] ) |DateTimeOffset.Now.Year - 1970| -Source Location: (1232:31,28 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1234:31,28 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | Generated Location: (7819:162,42 [3] ) | | -Source Location: (1235:31,31 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1237:31,31 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@(| Generated Location: (7822:162,45 [2] ) |@(| -Source Location: (1237:31,33 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1239:31,33 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | DateTimeOffset.Now.Year | Generated Location: (7824:162,47 [27] ) | DateTimeOffset.Now.Year | -Source Location: (1264:31,60 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1266:31,60 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| Generated Location: (7851:162,74 [1] ) |)| -Source Location: (1265:31,61 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1267:31,61 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | > 2014 | Generated Location: (7852:162,75 [10] ) | > 2014 | -Source Location: (1169:30,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1171:30,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| Generated Location: (8118:168,33 [1] ) |(| -Source Location: (1170:30,18 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1172:30,18 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"My age is this long.".Length| Generated Location: (8119:168,34 [29] ) |"My age is this long.".Length| -Source Location: (1199:30,47 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1201:30,47 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| Generated Location: (8148:168,63 [1] ) |)| -Source Location: (1304:33,9 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1306:33,9 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |someMethod(| Generated Location: (8289:173,12 [11] ) |someMethod(| -Source Location: (1359:33,64 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1361:33,64 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checked| Generated Location: (8711:177,63 [7] ) |checked| -Source Location: (1324:33,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1326:33,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |123| Generated Location: (8966:183,33 [3] ) |123| -Source Location: (1373:33,78 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1375:33,78 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| Generated Location: (9007:188,1 [1] ) |)| -Source Location: (1386:34,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +Source Location: (1388:34,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| Generated Location: (9146:193,10 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs index 440e01c61f..7606866679 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3cc5f5ed458e4e33874c4242798b195a31ab065c" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "51e77018024aeb0f14e5fc30bf13b895e48b90e2" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden @@ -220,10 +220,10 @@ __TestNamespace_InputTagHelper2.Checked = true; __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "time", 3, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); - AddHtmlAttributeValue("", 146, "Current", 146, 7, true); - AddHtmlAttributeValue(" ", 153, "Time:", 154, 6, true); + AddHtmlAttributeValue("", 148, "Current", 148, 7, true); + AddHtmlAttributeValue(" ", 155, "Time:", 156, 6, true); #line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" -AddHtmlAttributeValue(" ", 159, DateTime.Now, 160, 13, false); +AddHtmlAttributeValue(" ", 161, DateTime.Now, 162, 13, false); #line default #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml index 9b83d5f7fb..c71c637b14 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml @@ -1,4 +1,4 @@ -@addTagHelper "*, something" +@addTagHelper "*, TestAssembly" 2 TagHelpers. 1 TagHelper. diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml index fb38512fde..369558994e 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly"

diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt index 71fa77a4fa..8b9e33e90f 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt @@ -1,14 +1,14 @@ -Source Location: (144:4,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) +Source Location: (146:4,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| Generated Location: (1713:27,42 [4] ) |true| -Source Location: (220:5,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) +Source Location: (222:5,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| Generated Location: (2255:36,42 [4] ) |true| -Source Location: (41:2,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) +Source Location: (43:2,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |3| Generated Location: (2525:42,33 [1] ) |3| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs index e39d09db62..c3b081e29f 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b7cbc77774bfe558f4548cc5b3760f88754a329e" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f64041250fa76433a1542ae43458ed7ba286a01c" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml index d4429862bc..9963a14d5e 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml @@ -1,3 +1,3 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly" \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt index f4186ede11..1d5624408a 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt @@ -1,4 +1,4 @@ -Source Location: (65:2,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) +Source Location: (67:2,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |true| Generated Location: (1664:26,41 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs index 100f1eacce..982d179293 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1014725b9048d825ce97b0e5e260ac35f057fe0a" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "cce7d92553451468e4599af8a8329633dbad75a3" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml index 8480908aca..5e69ed1d81 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly" diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt index 296bd9e8ba..44b93ab824 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt @@ -1,149 +1,149 @@ -Source Location: (57:2,24 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (59:2,24 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| Generated Location: (901:18,27 [12] ) |DateTime.Now| -Source Location: (94:4,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (96:4,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | Generated Location: (1169:24,17 [12] ) |if (true) { | -Source Location: (107:4,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (109:4,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| Generated Location: (1349:29,33 [12] ) |string.Empty| -Source Location: (119:4,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (121:4,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | Generated Location: (1539:34,42 [10] ) | } else { | -Source Location: (130:4,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (132:4,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| Generated Location: (1740:39,56 [5] ) |false| -Source Location: (135:4,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (137:4,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| Generated Location: (1939:44,58 [2] ) | }| -Source Location: (174:6,22 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (176:6,22 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| Generated Location: (2204:50,25 [12] ) |DateTime.Now| -Source Location: (212:6,60 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (214:6,60 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| Generated Location: (2481:56,63 [12] ) |DateTime.Now| -Source Location: (254:8,15 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (256:8,15 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| Generated Location: (2750:62,18 [13] ) |long.MinValue| -Source Location: (269:8,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (271:8,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | Generated Location: (2929:67,30 [12] ) |if (true) { | -Source Location: (282:8,43 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (284:8,43 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| Generated Location: (3122:72,46 [12] ) |string.Empty| -Source Location: (294:8,55 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (296:8,55 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | Generated Location: (3325:77,55 [10] ) | } else { | -Source Location: (305:8,66 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (307:8,66 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| Generated Location: (3539:82,69 [5] ) |false| -Source Location: (310:8,71 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (312:8,71 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| Generated Location: (3751:87,71 [2] ) | }| -Source Location: (314:8,75 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (316:8,75 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| Generated Location: (3966:92,78 [12] ) |int.MaxValue| -Source Location: (346:9,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (348:9,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| Generated Location: (4201:98,20 [13] ) |long.MinValue| -Source Location: (361:9,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (363:9,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | Generated Location: (4383:103,32 [12] ) |if (true) { | -Source Location: (374:9,45 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (376:9,45 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| Generated Location: (4579:108,48 [12] ) |string.Empty| -Source Location: (386:9,57 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (388:9,57 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | Generated Location: (4785:113,57 [10] ) | } else { | -Source Location: (397:9,68 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (399:9,68 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| Generated Location: (5002:118,71 [5] ) |false| -Source Location: (402:9,73 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (404:9,73 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| Generated Location: (5217:123,73 [2] ) | }| -Source Location: (406:9,77 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (408:9,77 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| Generated Location: (5435:128,80 [12] ) |int.MaxValue| -Source Location: (443:11,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (445:11,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| Generated Location: (5707:134,20 [13] ) |long.MinValue| -Source Location: (458:11,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (460:11,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| Generated Location: (5892:139,35 [12] ) |DateTime.Now| -Source Location: (490:11,64 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (492:11,64 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| Generated Location: (6108:144,67 [12] ) |int.MaxValue| -Source Location: (527:13,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (529:13,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | Generated Location: (6377:150,17 [12] ) |if (true) { | -Source Location: (540:13,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (542:13,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| Generated Location: (6558:155,33 [12] ) |string.Empty| -Source Location: (552:13,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (554:13,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | Generated Location: (6749:160,42 [10] ) | } else { | -Source Location: (563:13,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (565:13,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| Generated Location: (6951:165,56 [5] ) |false| -Source Location: (568:13,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) +Source Location: (570:13,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| Generated Location: (7151:170,58 [2] ) | }| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs index b12ee9bb54..b6c57eacb1 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "107e341010aad754fc5c952722dbfdc7e33fc38e" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e044ca9442dd9f93d8ce7f93a79c46a542221f1e" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden @@ -35,9 +35,9 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); - AddHtmlAttributeValue("", 49, "prefix", 49, 6, true); + AddHtmlAttributeValue("", 51, "prefix", 51, 6, true); #line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue(" ", 55, DateTime.Now, 56, 13, false); +AddHtmlAttributeValue(" ", 57, DateTime.Now, 58, 13, false); #line default #line hidden @@ -56,7 +56,7 @@ AddHtmlAttributeValue(" ", 55, DateTime.Now, 56, 13, false); __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); - AddHtmlAttributeValue("", 93, new HelperResult(async(__razor_attribute_value_writer) => { + AddHtmlAttributeValue("", 95, new HelperResult(async(__razor_attribute_value_writer) => { #line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" if (true) { @@ -83,8 +83,8 @@ WriteTo(__razor_attribute_value_writer, string.Empty); #line default #line hidden } - ), 93, 44, false); - AddHtmlAttributeValue(" ", 137, "suffix", 138, 7, true); + ), 95, 44, false); + AddHtmlAttributeValue(" ", 139, "suffix", 140, 7, true); EndAddHtmlAttributeValues(__tagHelperExecutionContext); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -111,13 +111,13 @@ WriteTo(__razor_attribute_value_writer, string.Empty); __TestNamespace_InputTagHelper.Bound = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); - AddHtmlAttributeValue("", 204, "prefix", 204, 6, true); + AddHtmlAttributeValue("", 206, "prefix", 206, 6, true); #line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue(" ", 210, DateTime.Now, 211, 13, false); +AddHtmlAttributeValue(" ", 212, DateTime.Now, 213, 13, false); #line default #line hidden - AddHtmlAttributeValue(" ", 224, "suffix", 225, 7, true); + AddHtmlAttributeValue(" ", 226, "suffix", 227, 7, true); EndAddHtmlAttributeValues(__tagHelperExecutionContext); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -175,11 +175,11 @@ AddHtmlAttributeValue(" ", 210, DateTime.Now, 211, 13, false); __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue("", 345, long.MinValue, 345, 14, false); +AddHtmlAttributeValue("", 347, long.MinValue, 347, 14, false); #line default #line hidden - AddHtmlAttributeValue(" ", 359, new HelperResult(async(__razor_attribute_value_writer) => { + AddHtmlAttributeValue(" ", 361, new HelperResult(async(__razor_attribute_value_writer) => { #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" if (true) { @@ -206,9 +206,9 @@ AddHtmlAttributeValue("", 345, long.MinValue, 345, 14, false); #line default #line hidden } - ), 360, 44, false); + ), 362, 44, false); #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue(" ", 404, int.MaxValue, 405, 13, false); +AddHtmlAttributeValue(" ", 406, int.MaxValue, 407, 13, false); #line default #line hidden @@ -228,19 +228,19 @@ AddHtmlAttributeValue(" ", 404, int.MaxValue, 405, 13, false); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 5, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); #line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue("", 442, long.MinValue, 442, 14, false); +AddHtmlAttributeValue("", 444, long.MinValue, 444, 14, false); #line default #line hidden #line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue(" ", 456, DateTime.Now, 457, 13, false); +AddHtmlAttributeValue(" ", 458, DateTime.Now, 459, 13, false); #line default #line hidden - AddHtmlAttributeValue(" ", 470, "static", 471, 7, true); - AddHtmlAttributeValue(" ", 477, "content", 481, 11, true); + AddHtmlAttributeValue(" ", 472, "static", 473, 7, true); + AddHtmlAttributeValue(" ", 479, "content", 483, 11, true); #line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" -AddHtmlAttributeValue(" ", 488, int.MaxValue, 489, 13, false); +AddHtmlAttributeValue(" ", 490, int.MaxValue, 491, 13, false); #line default #line hidden @@ -259,7 +259,7 @@ AddHtmlAttributeValue(" ", 488, int.MaxValue, 489, 13, false); __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); - AddHtmlAttributeValue("", 526, new HelperResult(async(__razor_attribute_value_writer) => { + AddHtmlAttributeValue("", 528, new HelperResult(async(__razor_attribute_value_writer) => { #line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" if (true) { @@ -286,7 +286,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty); #line default #line hidden } - ), 526, 44, false); + ), 528, 44, false); EndAddHtmlAttributeValues(__tagHelperExecutionContext); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml index afe5f6ad7b..d68f666f72 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something +@addTagHelper *, TestAssembly

diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt index c04eee4243..094611d5d8 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt @@ -1,14 +1,14 @@ -Source Location: (60:3,26 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) +Source Location: (66:3,26 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || Generated Location: (1341:23,42 [0] ) || -Source Location: (120:5,30 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) +Source Location: (126:5,30 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || Generated Location: (1869:32,42 [0] ) || -Source Location: (86:4,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) +Source Location: (92:4,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || Generated Location: (2131:38,33 [0] ) || diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs index 371e54243c..734ba3629a 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ab5e45403d2c57cfdbab9546c3a27eea94f0fb5c" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ebd7c5a5d3edbcd879a6437ec728fafa9c84d312" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml index 903e99ebe4..d949682156 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly" @{ var enumValue = MyEnum.MyValue; diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt index 3f10bd9085..9f826a27ac 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt @@ -1,4 +1,4 @@ -Source Location: (35:2,2 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (37:2,2 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) | var enumValue = MyEnum.MyValue; | @@ -7,37 +7,37 @@ Generated Location: (848:18,2 [39] ) var enumValue = MyEnum.MyValue; | -Source Location: (94:6,15 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (96:6,15 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MyValue| Generated Location: (1259:26,39 [14] ) |MyEnum.MyValue| -Source Location: (129:7,15 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (131:7,15 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MySecondValue| Generated Location: (1627:33,18 [20] ) |MyEnum.MySecondValue| -Source Location: (169:8,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (171:8,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| Generated Location: (2116:40,133 [7] ) |MyValue| -Source Location: (196:9,14 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (198:9,14 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MySecondValue| Generated Location: (2593:47,133 [13] ) |MySecondValue| -Source Location: (222:9,40 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (224:9,40 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| Generated Location: (2870:52,139 [7] ) |MyValue| -Source Location: (249:10,15 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (251:10,15 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| Generated Location: (3253:59,39 [9] ) |enumValue| -Source Location: (272:10,38 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) +Source Location: (274:10,38 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| Generated Location: (3432:64,45 [9] ) |enumValue| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs index 73cc85f3ca..fad4bfd349 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f9124dcd7da8c06ab193a971690c676c5e0adaac" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c55ebb3869f93768c36d432f769272b9f8feeb0b" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden @@ -68,7 +68,7 @@ __TestNamespace_InputTagHelper.Value = MyEnum.MyValue; __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); #line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -AddHtmlAttributeValue("", 128, MyEnum.MySecondValue, 128, 21, false); +AddHtmlAttributeValue("", 130, MyEnum.MySecondValue, 130, 21, false); #line default #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml index 2cd3a16374..a7bc49af11 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml @@ -1,4 +1,4 @@ -@addTagHelper something +@addTagHelper *, TestAssembly diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt index a4b0c9c0d7..ce80c9e979 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt @@ -1,14 +1,14 @@ -Source Location: (100:3,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) +Source Location: (106:3,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| Generated Location: (880:18,32 [12] ) |DateTime.Now| -Source Location: (198:5,51 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) +Source Location: (204:5,51 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| Generated Location: (1281:25,54 [12] ) |DateTime.Now| -Source Location: (221:5,74 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) +Source Location: (227:5,74 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |true| Generated Location: (1648:32,74 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs index 79e9914074..a78adf5908 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "93da17a7091c4d218cfc54282dec1b7b7beac072" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e082322a2f2c103fcc2779608d1ef7fe4b915d75" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml index add07acf43..022784f426 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml @@ -1,3 +1,3 @@ -@addTagHelper something, nice +@addTagHelper "*, TestAssembly"