<commit_before>$currentPath = Split-Path $MyInvocation.MyCommand.Definition

# Directory where the projects and solutions are created
$testOutputPath = Join-Path $currentPath bin

# Directory where vs templates are located
$templatePath = Join-Path $currentPath ProjectTemplates

# Directory where test scripts are located
$testPath = Join-Path $currentPath tests

$utilityPath = Join-Path $currentPath utility.ps1

# Directory where the test packages are (This is passed to each test method)
$testRepositoryPath = Join-Path $currentPath Packages

$nugetRoot = Join-Path $currentPath "..\.."

$generatePackagesExePath = Join-Path $currentPath "GenerateTestPackages.exe"
if (-not (Test-Path $generatePackagesExePath)) 
{
    $toolsPath = "$nugetRoot\Tools"
    $generatePackagesProject = Join-Path $toolsPath NuGet\GenerateTestPackages\GenerateTestPackages.csproj
    $generatePackagesExePath = Join-Path $toolsPath NuGet\GenerateTestPackages\bin\Debug\GenerateTestPackages.exe
}

$nugetExePath = Join-Path $currentPath "NuGet.exe"

if (!(Test-Path $nugetExePath)) 
{
    $nugetExePath = "$nugetRoot\src\CommandLine\bin\Debug\NuGet.exe"
}

if (!(Test-Path $nugetExePath)) 
{
    $nugetExePath = "$nugetRoot\src\CommandLine\bin\Debug11\NuGet.exe"
}

$msbuildPath = Join-Path $env:windir Microsoft.NET\Framework\v4.0.30319\msbuild

if ($dte.Version.SubString(0, 2) -eq "10")
{
    $targetFrameworkVersion = "v4.0"
}
else
{
    $targetFrameworkVersion = "v4.5"
}

# TODO: Add the ability to rerun failed tests from the previous run

# Add intellisense for the test parameter
Register-TabExpansion 'Run-Test' @{
    'Test' = { 
        # Load all of the test scripts
        Get-ChildItem $testPath -Filter *.ps1 | %{ 
            . $_.FullName
        }
    
        # Get all of the tests functions
        Get-ChildItem function:\Test* | %{ $_.Name.Substring(5) }
    }
    'File' = { 
        # Get all of the tests files
        Get-ChildItem $testPath -Filter *.ps1 | Select-Object -ExpandProperty Name
    }
}

function Rearrange-Tests {
    param($tests)    

    if ($dte.Version -eq "12.0")
    {
        # TODO: Running PackageRestore tests on Dev12 RTM causes hang problem,
		# so disable those tests for now.
        $tests = $tests | ? {!($_.Name -like 'Test-PackageRestore*') }
    }

    $tests
}

function global:Run-Test {
    [CmdletBinding(DefaultParameterSetName="Test")]
    param(
        [parameter(ParameterSetName="Test", Position=0)]
        [string]$Test,
        [parameter(ParameterSetName="File", Mandatory=$true, Position=0)]<commit_msg>Disable package restore tests on Dev14<commit_after>$currentPath = Split-Path $MyInvocation.MyCommand.Definition

# Directory where the projects and solutions are created
$testOutputPath = Join-Path $currentPath bin

# Directory where vs templates are located
$templatePath = Join-Path $currentPath ProjectTemplates

# Directory where test scripts are located
$testPath = Join-Path $currentPath tests

$utilityPath = Join-Path $currentPath utility.ps1

# Directory where the test packages are (This is passed to each test method)
$testRepositoryPath = Join-Path $currentPath Packages

$nugetRoot = Join-Path $currentPath "..\.."

$generatePackagesExePath = Join-Path $currentPath "GenerateTestPackages.exe"
if (-not (Test-Path $generatePackagesExePath)) 
{
    $toolsPath = "$nugetRoot\Tools"
    $generatePackagesProject = Join-Path $toolsPath NuGet\GenerateTestPackages\GenerateTestPackages.csproj
    $generatePackagesExePath = Join-Path $toolsPath NuGet\GenerateTestPackages\bin\Debug\GenerateTestPackages.exe
}

$nugetExePath = Join-Path $currentPath "NuGet.exe"

if (!(Test-Path $nugetExePath)) 
{
    $nugetExePath = "$nugetRoot\src\CommandLine\bin\Debug\NuGet.exe"
}

if (!(Test-Path $nugetExePath)) 
{
    $nugetExePath = "$nugetRoot\src\CommandLine\bin\Debug11\NuGet.exe"
}

$msbuildPath = Join-Path $env:windir Microsoft.NET\Framework\v4.0.30319\msbuild

if ($dte.Version.SubString(0, 2) -eq "10")
{
    $targetFrameworkVersion = "v4.0"
}
else
{
    $targetFrameworkVersion = "v4.5"
}

# TODO: Add the ability to rerun failed tests from the previous run

# Add intellisense for the test parameter
Register-TabExpansion 'Run-Test' @{
    'Test' = { 
        # Load all of the test scripts
        Get-ChildItem $testPath -Filter *.ps1 | %{ 
            . $_.FullName
        }
    
        # Get all of the tests functions
        Get-ChildItem function:\Test* | %{ $_.Name.Substring(5) }
    }
    'File' = { 
        # Get all of the tests files
        Get-ChildItem $testPath -Filter *.ps1 | Select-Object -ExpandProperty Name
    }
}

function Rearrange-Tests {
    param($tests)    

    if ($dte.Version -eq "12.0" -or $dte.Version -eq "14.0")
    {
        # TODO: Running PackageRestore tests on Dev12 RTM causes hang problem,
		# so disable those tests for now.
        $tests = $tests | ? {!($_.Name -like 'Test-PackageRestore*') }
    }

    $tests
}

function global:Run-Test {
    [CmdletBinding(DefaultParameterSetName="Test")]
    param(
        [parameter(ParameterSetName="Test", Position=0)]
        [string]$Test,
        [parameter(ParameterSetName="File", Mandatory=$true, Position=0)]
{'fraction_non_alphanumeric': 0.11677282377919321, 'fraction_numerical': 0.011773788843852539, 'mean_word_length': 3.569664902998236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6694950', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1640, 'n_words': 406}