Skip to content

Fixes #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fixes #2

wants to merge 3 commits into from

Conversation

MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented Jun 1, 2025

Description

Type of change

  • 📖 [Docs]
  • 🪲 [Fix]
  • 🩹 [Patch]
  • ⚠️ [Security fix]
  • 🚀 [Feature]
  • 🌟 [Breaking change]

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

…nd restore test cases in MemoryMappedFile.Tests.ps1
@Copilot Copilot AI review requested due to automatic review settings June 1, 2025 16:47
Copy link

@Copilot 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

This PR restores and enhances automated tests for MemoryMappedFile cmdlets and updates the file-creation logic in the New-MemoryMappedFile function.

  • Re-enabled and added tests for New-, Get-, and Set-MemoryMappedFile in the PowerShell test suite
  • Simplified file-existence branching in New-MemoryMappedFile.ps1 and added parent-directory creation
  • Removed special handling for existing non-empty files

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/MemoryMappedFile.Tests.ps1 Uncomments existing test and adds Get/Set cmdlet tests
src/functions/public/New-MemoryMappedFile.ps1 Simplifies existence checks and attempts to create the target directory
Comments suppressed due to low confidence (2)

src/functions/public/New-MemoryMappedFile.ps1:55

  • [nitpick] The $Size variable is populated but never used in the revised logic. Consider removing the unused size check or repurposing it to validate file content.
$Size = $file.Length

src/functions/public/New-MemoryMappedFile.ps1:58

  • The variable $directory is undefined here. Derive the parent directory from $Path, for example: $directory = Split-Path -Path $Path -Parent before invoking New-Item.
$null = New-Item -ItemType Directory -Path $directory -Force

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.

1 participant