mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
add vbscript integration test
This commit is contained in:
parent
6d53e43e7d
commit
e8aa426846
3 changed files with 37 additions and 4 deletions
|
@ -3,11 +3,29 @@ script = <<-EOH
|
|||
Write-Output 'hello'
|
||||
EOH
|
||||
|
||||
# Write-Output comes with a newline
|
||||
describe powershell(script) do
|
||||
its('stdout') { should eq 'hello' }
|
||||
its('stdout') { should eq "hello\r\n" }
|
||||
its('stderr') { should eq '' }
|
||||
end
|
||||
|
||||
# legacy test
|
||||
# legacy test with `script` resource
|
||||
describe script(script) do
|
||||
its('stdout') { should eq 'hello' }
|
||||
its('stdout') { should eq "hello\r\n" }
|
||||
its('stderr') { should eq '' }
|
||||
end
|
||||
|
||||
# -NoNewLine only works in powershell 5
|
||||
# @see https://blogs.technet.microsoft.com/heyscriptingguy/2015/08/07/the-powershell-5-nonewline-parameter/
|
||||
describe powershell("'hello' | Write-Host -NoNewLine") do
|
||||
its('stdout') { should eq 'hello' }
|
||||
its('stderr') { should eq '' }
|
||||
end
|
||||
|
||||
# test stderr
|
||||
describe powershell("Write-Error \"error\"") do
|
||||
its('stdout') { should eq '' }
|
||||
# this is an xml error for now, if the script is run via WinRM
|
||||
# @see https://github.com/WinRb/WinRM/issues/106
|
||||
# its('stderr') { should eq 'error' }
|
||||
end
|
||||
|
|
15
test/integration/default/vbscript_spec.rb
Normal file
15
test/integration/default/vbscript_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
# encoding: utf-8
|
||||
|
||||
# script that may have multiple lines
|
||||
vbscript = <<-EOH
|
||||
WScript.Echo "hello"
|
||||
EOH
|
||||
|
||||
describe vbscript(vbscript) do
|
||||
its('stdout') { should eq "hello\r\n" }
|
||||
end
|
||||
|
||||
# ensure that we do not require a newline
|
||||
describe vbscript("Wscript.Stdout.Write \"hello\"") do
|
||||
its('stdout') { should eq 'hello' }
|
||||
end
|
|
@ -5,7 +5,7 @@
|
|||
require 'helper'
|
||||
require 'inspec/resource'
|
||||
|
||||
describe 'Inspec::Resources::Script' do
|
||||
describe 'Inspec::Resources::Powershell' do
|
||||
|
||||
ps1_script = <<-EOH
|
||||
# call help for get command
|
||||
|
|
Loading…
Add table
Reference in a new issue