rework filters & mappings
config defines a single datastructure that can act both as a Map and as a Filter (DatasetMapFilter) Cleanup wildcard syntax along the way (also changes semantics).
This commit is contained in:
@@ -17,3 +17,14 @@ func TestZFSListHandlesProducesZFSErrorOnNonZeroExit(t *testing.T) {
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, "error: this is a mock\n", string(zfsError.Stderr))
|
||||
}
|
||||
|
||||
func TestDatasetPathTrimNPrefixComps(t *testing.T) {
|
||||
p, err := NewDatasetPath("foo/bar/a/b")
|
||||
assert.Nil(t, err)
|
||||
p.TrimNPrefixComps(2)
|
||||
assert.True(t, p.Equal(toDatasetPath("a/b")))
|
||||
p.TrimNPrefixComps((2))
|
||||
assert.True(t, p.Empty())
|
||||
p.TrimNPrefixComps((1))
|
||||
assert.True(t, p.Empty(), "empty trimming shouldn't do harm")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user