forked from scottmuc/PowerYaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPowerYaml.Tests.ps1
34 lines (26 loc) · 954 Bytes
/
PowerYaml.Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Import-Module $here\PowerYaml.psm1 -Force
Describe "PoweYaml when parsing strings" {
It "Obtains a HashTable given a yaml hash" {
$yaml = Get-Yaml -FromString "key: value"
$yaml.GetType().Name.should.be("HashTable")
}
It "Obtains an Object[] given a yaml array" {
$yaml = Get-Yaml -FromString "- test`n- test2"
$yaml.GetType().Name.should.be("Object[]")
}
}
Describe "Using Power Yaml to read a file" {
Setup -File "sample.yml" "test: value"
It "Can read the file and get the value" {
$yaml = Get-Yaml -FromFile "$TestDrive\sample.yml"
$yaml.test.should.be("value")
}
}
Describe "Using Power Yaml to convert integer scalars" {
It "Obtains an int given an integer value" {
$yaml = Get-Yaml -FromString "key: 5"
$yaml.key.ToInt().GetType().Name.should.be("Int32")
}
}
Remove-Module PowerYaml