mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-04 00:14:55 +08:00
Added File operators
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package yqlib
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var fileOperatorScenarios = []expressionScenario{
|
||||
{
|
||||
description: "Get filename",
|
||||
document: `{}`,
|
||||
expression: `filename`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!str)::sample.yml\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Get file index",
|
||||
document: `{}`,
|
||||
expression: `fileIndex`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!int)::0\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestFileOperatorsScenarios(t *testing.T) {
|
||||
for _, tt := range fileOperatorScenarios {
|
||||
testScenario(t, &tt)
|
||||
}
|
||||
documentScenarios(t, "File Operators", fileOperatorScenarios)
|
||||
}
|
||||
Reference in New Issue
Block a user