add vbscript integration test

This commit is contained in:
Christoph Hartmann 2016-03-18 23:22:15 +01:00 committed by Dominik Richter
parent 6d53e43e7d
commit e8aa426846
3 changed files with 37 additions and 4 deletions

View file

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

View 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

View file

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