| // Copyright 2021 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package codifier |
| |
| import ( |
| "testing" |
| ) |
| |
| func TestListContainsOp(t *testing.T) { |
| var p *Proc |
| if p.ListContains("l", "x") { |
| t.Error("expected false to nil Proc") |
| } |
| p = NewProcFromString("foo") |
| if p.ListContains("k", "x") { |
| t.Error("expected false for absent key") |
| } |
| p.Store["l"] = []string{} |
| if p.ListContains("l", "x") { |
| t.Error("expected false due to empty list") |
| } |
| p.Store["l"] = orderedStrings{"w", "x", "y", "z"} |
| p.print(-1) |
| if !p.ListContains("l", "x") { |
| t.Error("expected list item to be found") |
| } |
| } |