github.com/attic-labs/noms@v0.0.0-20210827224422-e5fa29d95e8b/samples/go/counter/counter_test.go (about) 1 // Copyright 2016 Attic Labs, Inc. All rights reserved. 2 // Licensed under the Apache License, version 2.0: 3 // http://www.apache.org/licenses/LICENSE-2.0 4 5 package main 6 7 import ( 8 "testing" 9 10 "github.com/attic-labs/noms/go/spec" 11 "github.com/attic-labs/noms/go/util/clienttest" 12 "github.com/stretchr/testify/suite" 13 ) 14 15 func TestCounter(t *testing.T) { 16 suite.Run(t, &counterTestSuite{}) 17 } 18 19 type counterTestSuite struct { 20 clienttest.ClientTestSuite 21 } 22 23 func (s *counterTestSuite) TestCounter() { 24 spec := spec.CreateValueSpecString("nbs", s.DBDir, "counter") 25 args := []string{spec} 26 stdout, stderr := s.MustRun(main, args) 27 s.Equal("1\n", stdout) 28 s.Equal("", stderr) 29 stdout, stderr = s.MustRun(main, args) 30 s.Equal("2\n", stdout) 31 s.Equal("", stderr) 32 stdout, stderr = s.MustRun(main, args) 33 s.Equal("3\n", stdout) 34 s.Equal("", stderr) 35 }