github.com/theishshah/operator-sdk@v0.6.0/pkg/scaffold/gitignore_test.go (about) 1 // Copyright 2018 The Operator-SDK Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package scaffold 16 17 import ( 18 "testing" 19 20 "github.com/operator-framework/operator-sdk/internal/util/diffutil" 21 ) 22 23 func TestGitignore(t *testing.T) { 24 s, buf := setupScaffoldAndWriter() 25 err := s.Execute(appConfig, &Gitignore{}) 26 if err != nil { 27 t.Fatalf("Failed to execute the scaffold: (%v)", err) 28 } 29 30 if gitignoreExp != buf.String() { 31 diffs := diffutil.Diff(gitignoreExp, buf.String()) 32 t.Fatalf("Expected vs actual differs.\n%v", diffs) 33 } 34 } 35 36 const gitignoreExp = `# Temporary Build Files 37 build/_output 38 build/_test 39 # Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode 40 ### Emacs ### 41 # -*- mode: gitignore; -*- 42 *~ 43 \#*\# 44 /.emacs.desktop 45 /.emacs.desktop.lock 46 *.elc 47 auto-save-list 48 tramp 49 .\#* 50 # Org-mode 51 .org-id-locations 52 *_archive 53 # flymake-mode 54 *_flymake.* 55 # eshell files 56 /eshell/history 57 /eshell/lastdir 58 # elpa packages 59 /elpa/ 60 # reftex files 61 *.rel 62 # AUCTeX auto folder 63 /auto/ 64 # cask packages 65 .cask/ 66 dist/ 67 # Flycheck 68 flycheck_*.el 69 # server auth directory 70 /server/ 71 # projectiles files 72 .projectile 73 projectile-bookmarks.eld 74 # directory configuration 75 .dir-locals.el 76 # saveplace 77 places 78 # url cache 79 url/cache/ 80 # cedet 81 ede-projects.el 82 # smex 83 smex-items 84 # company-statistics 85 company-statistics-cache.el 86 # anaconda-mode 87 anaconda-mode/ 88 ### Go ### 89 # Binaries for programs and plugins 90 *.exe 91 *.exe~ 92 *.dll 93 *.so 94 *.dylib 95 # Test binary, build with 'go test -c' 96 *.test 97 # Output of the go coverage tool, specifically when used with LiteIDE 98 *.out 99 ### Vim ### 100 # swap 101 .sw[a-p] 102 .*.sw[a-p] 103 # session 104 Session.vim 105 # temporary 106 .netrwhist 107 # auto-generated tag files 108 tags 109 ### VisualStudioCode ### 110 .vscode/* 111 .history 112 # End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode 113 `