Skip to content

Add unit tests for EnvironmentFilesParser utility#11373

Merged
jonathanpeppers merged 2 commits into
mainfrom
copilot/add-unit-tests-environment-files-parser
May 15, 2026
Merged

Add unit tests for EnvironmentFilesParser utility#11373
jonathanpeppers merged 2 commits into
mainfrom
copilot/add-unit-tests-environment-files-parser

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

EnvironmentFilesParser contains non-trivial parsing logic for environment config files (log levels, GC params, mono debug, HTTP handlers, assembly preload, broken exception transitions) with no test coverage.

Tests added

  • Flag detection: MONO_LOG_LEVEL=, MONO_GC_PARAMS=, MONO_DEBUG=, XA_HTTP_CLIENT_HANDLER_TYPE=
  • XA2000 warning: MONO_GC_PARAMS=bridge-implementation=old triggers coded warning
  • Sequence points: MONO_DEBUG= appends gen-compact-seq-points when SequencePointsMode != None, skips if already present
  • Line filtering: mono.enable_assembly_preload= and XA_BROKEN_EXCEPTION_TRANSITIONS= set flags but are excluded from EnvironmentVariableLines
  • AreBrokenExceptionTransitionsEnabled: true/false paths
  • Edge cases: null environments, multi-file flag accumulation
[Test]
public void MonoGCParams_OldBridgeWarning ()
{
	var envFile = CreateEnvFile ("MONO_GC_PARAMS=bridge-implementation=old");
	var warnings = new List<BuildWarningEventArgs> ();
	var engine = new MockBuildEngine (TestContext.Out, warnings: warnings);
	var log = new TaskLoggingHelper (engine, "Test");
	var parser = new EnvironmentFilesParser ();

	parser.Parse (new [] { envFile }, SequencePointsMode.None, log);

	Assert.IsTrue (parser.HaveMonoGCParams);
	Assert.AreEqual (1, warnings.Count);
	Assert.AreEqual ("XA2000", warnings [0].Code);
}

Agent-Logs-Url: https://github.com/dotnet/android/sessions/c7f75fd9-6bb6-43ac-9c79-a9136217c5db

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for EnvironmentFilesParser utility Add unit tests for EnvironmentFilesParser utility May 15, 2026
Copilot AI requested a review from jonathanpeppers May 15, 2026 17:55
@jonathanpeppers jonathanpeppers marked this pull request as ready for review May 15, 2026 18:49
Copilot AI review requested due to automatic review settings May 15, 2026 18:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new NUnit test fixture covering the previously untested EnvironmentFilesParser utility, exercising flag detection, the XA2000 warning, sequence-points appending, line filtering, AreBrokenExceptionTransitionsEnabled, and basic edge cases.

Changes:

  • New EnvironmentFilesParserTests fixture with per-test temp-file setup/teardown
  • Tests for each parser flag (HaveLogLevel, HaveMonoGCParams, HaveMonoDebug, HaveHttpMessageHandler, BrokenExceptionTransitions)
  • Tests for XA2000 warning, MONO_DEBUG sequence-points append/dedup, multi-file accumulation, and null input

@jonathanpeppers jonathanpeppers merged commit 49f3cfb into main May 15, 2026
7 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/add-unit-tests-environment-files-parser branch May 15, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix-finder] Add unit tests for EnvironmentFilesParser utility

3 participants