Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Get tets working with core.autocrlf=false #2729

Closed
wants to merge 1 commit into from

Conversation

dougbu
Copy link
Member

@dougbu dougbu commented Jun 23, 2015

  • Some Unit Test for Razor Templating are failing, when global .gitgnore config has core.autocrlf = false #1514
  • refactor RazorCompilationService to allow a test subclass that normalizes Razor file line endings
    • add TestRazorCompilationService to RazorPageExecutionInstrumentationWebSite
    • adjust line endings to match in RazorPageExecutionInstrumentationTest
  • add ignoreLineEndingDifferences: true to Assert.Equal() calls
    • responses on Windows can have a mix of line endings
    • git config setting affects line endings in .cshtml (and baseline) files
    • however MVC and Razor mix Environment.NewLines into HTTP responses
  • update PrecompilationTest to split response regardless of line endings
  • update ResourceFile to normalize all source file streams to LF only
    • ensures consistent checksums and line mappings
    • change MvcRazorHostTest to expect new line mappings
    • recreate baseline files to expect new checksums and literal line endings
  • use verbatim strings in affected tests
    • careful use of Environment.NewLine in expectations is now just noise

nits:

  • add doc comments in RazorCompilationService
  • correct TagHelpersTest name to match containing file
  • avoid incorrect using removal when GENERATE_BASELINES is not defined
  • remove unnecessary ResourceFile normalization of output files

- #1514
- refactor `RazorCompilationService` to allow a test subclass that normalizes Razor file line endings
 - add `TestRazorCompilationService` to `RazorPageExecutionInstrumentationWebSite`
 - adjust line endings to match in `RazorPageExecutionInstrumentationTest`
- add `ignoreLineEndingDifferences: true` to `Assert.Equal()` calls
 - responses on Windows can have a mix of line endings
  - `git config` setting affects line endings in .cshtml (and baseline) files
  - however MVC and Razor mix `Environment.NewLine`s into HTTP responses
- update `PrecompilationTest` to split response regardless of line endings
- update `ResourceFile` to normalize all source file streams to LF only
 - ensures consistent checksums and line mappings
 - change `MvcRazorHostTest` to expect new line mappings
 - recreate baseline files to expect new checksums and literal line endings
- use verbatim strings in affected tests
 - careful use of `Environment.NewLine` in expectations is now just noise

nits:
- add doc comments in `RazorCompilationService`
- correct `TagHelpersTest` name to match containing file
- avoid incorrect `using` removal when `GENERATE_BASELINES` is not defined
- remove unnecessary `ResourceFile` normalization of output files
@dougbu
Copy link
Member Author

dougbu commented Jun 23, 2015

/cc @somasegar because this PR likely interacts with your Travis work

@dougbu
Copy link
Member Author

dougbu commented Jun 23, 2015

Sorry I meant to /cc @sornaks

@Eilon
Copy link
Member

Eilon commented Jun 24, 2015

Looks :shipit: to me!

@sornaks
Copy link

sornaks commented Jun 24, 2015

Looks perfect! :) :shipit:

@dougbu
Copy link
Member Author

dougbu commented Jun 24, 2015

9c63d1d

@dougbu dougbu closed this Jun 24, 2015
@dougbu dougbu deleted the dougbu/autocrlf.false.1514 branch June 24, 2015 23:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants