Debian Codegraph @

temp/temptest/example_test.go

raw symbols SCIP
1 /*
2 Copyright 2017 The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package temptestscip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/
18
19 import (
20 "errorsscip-go gomod github.com/golang/go/src go1.23 errors/"
21 "fmtscip-go gomod github.com/golang/go/src go1.23 fmt/"
22 "ioscip-go gomod github.com/golang/go/src go1.23 io/"
23
24 "k8s.io/utils/tempscip-go gomod k8s.io/utils . `k8s.io/utils/temp`/"
25 )
26
27 func TestedCodescip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/TestedCode().(dir tempscip-go gomod k8s.io/utils . `k8s.io/utils/temp`/.Directoryscip-go gomod k8s.io/utils . `k8s.io/utils/temp`/Directory#) error {
28 f, err := dir.NewFilescip-go gomod k8s.io/utils . `k8s.io/utils/temp`/Directory#NewFile.("filename")
29 if err != nil {
30 return err
31 }
32 _, err = ioscip-go gomod github.com/golang/go/src go1.23 io/.WriteStringscip-go gomod github.com/golang/go/src go1.23 io/WriteString().(f, "Bonjour!")
33 if err != nil {
34 return err
35 }
36 return dir.Deletescip-go gomod k8s.io/utils . `k8s.io/utils/temp`/Directory#Delete.()
37 }
38
39 func Examplescip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/Example().() {
40 dir := FakeDirscip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/FakeDir#{}
41
42 err := TestedCodescip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/TestedCode().(&dir)
43 if err != nil {
44 panic(err)
45 }
46
47 if dir.Deletedscip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/FakeDir#Deleted. == false {
48 panic(errorsscip-go gomod github.com/golang/go/src go1.23 errors/.Newscip-go gomod github.com/golang/go/src go1.23 errors/New().("Directory should have been deleted"))
49 }
50
51 if dir.Filesscip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/FakeDir#Files.["filename"] == nil {
52 panic(errorsscip-go gomod github.com/golang/go/src go1.23 errors/.Newscip-go gomod github.com/golang/go/src go1.23 errors/New().(`"filename" should have been created`))
53 }
54
55 fmtscip-go gomod github.com/golang/go/src go1.23 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.23 fmt/Println().(dir.Filesscip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/FakeDir#Files.["filename"].Bufferscip-go gomod k8s.io/utils . `k8s.io/utils/temp/temptest`/FakeFile#Buffer..Stringscip-go gomod github.com/golang/go/src go1.23 bytes/Buffer#String().())
56 // Output: Bonjour!
57 }