From 73fa64c350be6e79cd5b09e6436c22223bb25695 Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Thu, 17 Mar 2016 22:48:35 -0700 Subject: [PATCH 1/2] Add Pester tests for calling native Linux commands for issue 138 --- test/powershell/NativeLinuxCommands.Tests.ps1 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/powershell/NativeLinuxCommands.Tests.ps1 diff --git a/test/powershell/NativeLinuxCommands.Tests.ps1 b/test/powershell/NativeLinuxCommands.Tests.ps1 new file mode 100644 index 0000000000..1d5ebd736b --- /dev/null +++ b/test/powershell/NativeLinuxCommands.Tests.ps1 @@ -0,0 +1,22 @@ +Describe "NativeLinuxCommands" { + It "Should return a type of System.Object for hostname cmdlet" { + (hostname).GetType().BaseType | Should Be 'System.Object' + (hostname).GetType().Name | Should Be String + } + + It "Should have not empty Name flags set for ps object" { + ps | foreach-object { $_.ProcessName | Should Not BeNullOrEmpty } + } + + It "Should be able to call using the touch, cat, rm cmdlet" { + { touch /NativeLinuxCommandsTestFile } | Should Not Throw + { cat /NativeLinuxCommandsTestFile } | Should Not Throw + { rm /NativeLinuxCommandsTestFile } | Should Not Throw + } + + It "Should be able to call using the mkdir, ls, rm cmdlet" { + { mkdir /NativeLinuxCommandsTestFolder } | Should Not Throw + { ls /NativeLinuxCommandsTestFolder } | Should Not Throw + { rm /NativeLinuxCommandsTestFolder } | Should Not Throw + } +} From bf80880b518cbf9e2f8e38ca220d9f9f7752452f Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Fri, 18 Mar 2016 00:23:57 -0700 Subject: [PATCH 2/2] Update Pester test for calling native Linux commands for isssue 138 --- test/powershell/NativeLinuxCommands.Tests.ps1 | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/test/powershell/NativeLinuxCommands.Tests.ps1 b/test/powershell/NativeLinuxCommands.Tests.ps1 index 1d5ebd736b..c765ef722c 100644 --- a/test/powershell/NativeLinuxCommands.Tests.ps1 +++ b/test/powershell/NativeLinuxCommands.Tests.ps1 @@ -8,15 +8,23 @@ Describe "NativeLinuxCommands" { ps | foreach-object { $_.ProcessName | Should Not BeNullOrEmpty } } - It "Should be able to call using the touch, cat, rm cmdlet" { - { touch /NativeLinuxCommandsTestFile } | Should Not Throw - { cat /NativeLinuxCommandsTestFile } | Should Not Throw - { rm /NativeLinuxCommandsTestFile } | Should Not Throw + It "Should find Application grep" -Skip:$IsWindows { + (get-command grep).CommandType | Should Be Application + } + + It "Should pipe to grep and get result" -Skip:$IsWindows { + "hello world" | grep hello | Should Be "hello world" } - It "Should be able to call using the mkdir, ls, rm cmdlet" { - { mkdir /NativeLinuxCommandsTestFolder } | Should Not Throw - { ls /NativeLinuxCommandsTestFolder } | Should Not Throw - { rm /NativeLinuxCommandsTestFolder } | Should Not Throw + It "Should find Application touch" -Skip:$IsWindows { + (get-command touch).CommandType | Should Be Application + } + + It "Should find Alias ls" -Skip:$IsWindows { + (get-command ls).CommandType | Should Be Alias + } + + It "Should find Function mkdir" -Skip:$IsWindows { + (get-command mkdir).CommandType | Should Be Function } }