Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Management.Automation.Runspaces;
using Microsoft.PowerShell.Commands.Internal.Format;

Expand Down Expand Up @@ -168,40 +167,29 @@ protected override void ProcessRecord()
typedefs.Add(consolidatedTypeName, viewList);
}
viewList.Add(formatdef);
}
}// foreach(ViewDefinition...

if (typedefs.Count == 0)
// write out all the available type definitions
foreach (var pair in typedefs)
{
ErrorRecord errorRecord = new ErrorRecord(
new TypeLoadException(StringUtil.Format(GetFormatDataStrings.SpecifiedTypeNotFound, _typename)),
"SpecifiedTypeNotFound",
ErrorCategory.InvalidOperation,
_typename);
WriteError(errorRecord);
}
else
{
foreach (var pair in typedefs)
{
var typeNames = pair.Key;
var typeNames = pair.Key;

if (writeOldWay)
if (writeOldWay)
{
foreach (var typeName in typeNames)
{
foreach (var typeName in typeNames)
{
var etd = new ExtendedTypeDefinition(typeName, pair.Value);
WriteObject(etd);
}
var etd = new ExtendedTypeDefinition(typeName, pair.Value);
WriteObject(etd);
}
else
}
else
{
var etd = new ExtendedTypeDefinition(typeNames[0], pair.Value);
for (int i = 1; i < typeNames.Count; i++)
{
var etd = new ExtendedTypeDefinition(typeNames[0], pair.Value);
for (int i = 1; i < typeNames.Count; i++)
{
etd.TypeNames.Add(typeNames[i]);
}
WriteObject(etd);
etd.TypeNames.Add(typeNames[i]);
}
WriteObject(etd);
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

Describe "Get-FormatData" -Tags "CI" {

Context "Check return type of Get-FormatData" {
Expand All @@ -10,11 +9,4 @@ Describe "Get-FormatData" -Tags "CI" {
,$result | Should -BeOfType "System.Object[]"
}
}

Context "Check for error on invalid type as argument" {

It "Should throw error on invalid type as argument" {
{ Get-FormatData "NoSuch.Type.Exists.Or.IsLoaded" -ErrorAction Stop } | Should -Throw -ErrorId "SpecifiedTypeNotFound,Microsoft.PowerShell.Commands.GetFormatDataCommand"
}
}
}