github.com/hattya/nazuna@v0.7.1-0.20240331055452-55e14c275c1c/cmd/nzn/vcs_test.go (about) 1 // 2 // nazuna/cmd/nzn :: vcs_test.go 3 // 4 // Copyright (c) 2013-2022 Akinori Hattori <hattya@gmail.com> 5 // 6 // SPDX-License-Identifier: MIT 7 // 8 9 package main 10 11 import ( 12 "testing" 13 14 "github.com/hattya/go.cli" 15 ) 16 17 func TestVCS(t *testing.T) { 18 s := script{ 19 { 20 cmd: []string{"setup"}, 21 }, 22 { 23 cmd: []string{"cd", "$wc"}, 24 }, 25 { 26 cmd: []string{"nzn", "init", "--vcs", "git"}, 27 }, 28 { 29 cmd: []string{"nzn", "vcs", "--version"}, 30 out: cli.Dedent(` 31 git version \d.+ (re) 32 `), 33 }, 34 } 35 if err := s.exec(t); err != nil { 36 t.Error(err) 37 } 38 } 39 40 func TestVCSError(t *testing.T) { 41 s := script{ 42 { 43 cmd: []string{"setup"}, 44 }, 45 { 46 cmd: []string{"cd", "$wc"}, 47 }, 48 { 49 cmd: []string{"nzn", "vcs", "--version"}, 50 out: cli.Dedent(` 51 nzn: no repository found in '.+' \(\.nzn not found\)! (re) 52 [1] 53 `), 54 }, 55 } 56 if err := s.exec(t); err != nil { 57 t.Error(err) 58 } 59 }