mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
9cfc86d2ab
Light formatting changes, change order of example and matchers, slight color changes Signed-off-by: hannah-radish <hmaddy@chef.io>
54 lines
1 KiB
Text
54 lines
1 KiB
Text
---
|
|
title: About the vbscript Resource
|
|
---
|
|
|
|
# vbscript
|
|
|
|
Use the `vbscript` InSpec audit resource to test a VBScript on the Windows platform.
|
|
|
|
<br>
|
|
|
|
## Syntax
|
|
|
|
A `vbscript` resource block tests the output of a VBScript on the Windows platform:
|
|
|
|
describe vbscript('script contents') do
|
|
its('stdout') { should eq 'output' }
|
|
end
|
|
|
|
where
|
|
|
|
* `'script_name'` is the name of the VBScript to test
|
|
* `('output')` is the expected output of the VBScript
|
|
|
|
<br>
|
|
|
|
## Examples
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
### Test a VBScript
|
|
|
|
A VBScript file similar to:
|
|
|
|
script = <<-EOH
|
|
WScript.Echo "hello"
|
|
EOH
|
|
|
|
may be tested for multiple lines:
|
|
|
|
describe vbscript(script) do
|
|
its('stdout') { should eq "hello\r\n" }
|
|
end
|
|
|
|
and tested for whitespace removal from standard output:
|
|
|
|
describe vbscript(script) do
|
|
its('strip') { should eq "hello" }
|
|
end
|
|
|
|
<br>
|
|
|
|
## Matchers
|
|
|
|
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|