github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/flag/string_array_test.go (about)

     1  // Copyright (c) 2019 Arista Networks, Inc.
     2  // Use of this source code is governed by the Apache License 2.0
     3  // that can be found in the COPYING file.
     4  
     5  package flag
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func TestStringArrayFlag(t *testing.T) {
    12  
    13  	var excludePathPrefixes = StringArrayOption{}
    14  	if len(excludePathPrefixes) != 0 {
    15  		t.Fatalf("Expected length 0, saw %d", len(excludePathPrefixes))
    16  	}
    17  
    18  	if err := excludePathPrefixes.Set("arg1"); err != nil {
    19  		t.Fatal(err)
    20  	}
    21  	if len(excludePathPrefixes) != 1 {
    22  		t.Fatalf("Expected length 1, saw %d", len(excludePathPrefixes))
    23  	}
    24  }