Unknown file type should default to yaml, Fixes #1609

This commit is contained in:
Mike Farah
2023-03-20 09:16:20 +11:00
parent 7305b50ffe
commit 48b481b68d
2 changed files with 36 additions and 4 deletions
+17
View File
@@ -2,6 +2,7 @@
setUp() {
rm test*.yml 2>/dev/null || true
rm test*.tfstate 2>/dev/null || true
rm test*.json 2>/dev/null || true
rm test*.properties 2>/dev/null || true
rm test*.csv 2>/dev/null || true
@@ -29,6 +30,22 @@ EOM
assertEquals "$expected" "$X"
}
testInputTfstate() {
cat >test.tfstate <<EOL
{ "mike" : { "things": "cool" } }
EOL
read -r -d '' expected << EOM
{"mike": {"things": "cool"}}
EOM
X=$(./yq test.tfstate)
assertEquals "$expected" "$X"
X=$(./yq ea test.tfstate)
assertEquals "$expected" "$X"
}
testInputJsonOutputYaml() {
cat >test.json <<EOL
{ "mike" : { "things": "cool" } }