diff options
Diffstat (limited to 'go/ssa/testdata/src')
-rw-r--r-- | go/ssa/testdata/src/README.txt | 5 | ||||
-rw-r--r-- | go/ssa/testdata/src/bytes/bytes.go | 3 | ||||
-rw-r--r-- | go/ssa/testdata/src/context/context.go | 7 | ||||
-rw-r--r-- | go/ssa/testdata/src/encoding/encoding.go | 9 | ||||
-rw-r--r-- | go/ssa/testdata/src/encoding/json/json.go | 4 | ||||
-rw-r--r-- | go/ssa/testdata/src/encoding/xml/xml.go | 4 | ||||
-rw-r--r-- | go/ssa/testdata/src/errors/errors.go | 3 | ||||
-rw-r--r-- | go/ssa/testdata/src/fmt/fmt.go | 11 | ||||
-rw-r--r-- | go/ssa/testdata/src/io/io.go | 5 | ||||
-rw-r--r-- | go/ssa/testdata/src/log/log.go | 5 | ||||
-rw-r--r-- | go/ssa/testdata/src/math/math.go | 15 | ||||
-rw-r--r-- | go/ssa/testdata/src/os/os.go | 5 | ||||
-rw-r--r-- | go/ssa/testdata/src/reflect/reflect.go | 40 | ||||
-rw-r--r-- | go/ssa/testdata/src/runtime/runtime.go | 5 | ||||
-rw-r--r-- | go/ssa/testdata/src/sort/sort.go | 13 | ||||
-rw-r--r-- | go/ssa/testdata/src/strconv/strconv.go | 6 | ||||
-rw-r--r-- | go/ssa/testdata/src/strings/strings.go | 13 | ||||
-rw-r--r-- | go/ssa/testdata/src/sync/atomic/atomic.go | 5 | ||||
-rw-r--r-- | go/ssa/testdata/src/sync/sync.go | 12 | ||||
-rw-r--r-- | go/ssa/testdata/src/time/time.go | 24 | ||||
-rw-r--r-- | go/ssa/testdata/src/unsafe/unsafe.go | 4 |
21 files changed, 198 insertions, 0 deletions
diff --git a/go/ssa/testdata/src/README.txt b/go/ssa/testdata/src/README.txt new file mode 100644 index 000000000..ee5909318 --- /dev/null +++ b/go/ssa/testdata/src/README.txt @@ -0,0 +1,5 @@ +These files are present to test building ssa on go files that use signatures from standard library packages. + +Only the exported members used by the tests are needed. + +Providing these decreases testing time ~10x (90s -> 8s) compared to building the standard library packages form source during tests.
\ No newline at end of file diff --git a/go/ssa/testdata/src/bytes/bytes.go b/go/ssa/testdata/src/bytes/bytes.go new file mode 100644 index 000000000..deb7fdd7d --- /dev/null +++ b/go/ssa/testdata/src/bytes/bytes.go @@ -0,0 +1,3 @@ +package bytes + +func Compare(a, b []byte) int diff --git a/go/ssa/testdata/src/context/context.go b/go/ssa/testdata/src/context/context.go new file mode 100644 index 000000000..d4f6c256c --- /dev/null +++ b/go/ssa/testdata/src/context/context.go @@ -0,0 +1,7 @@ +package context + +type Context interface { + Done() <-chan struct{} +} + +func Background() Context diff --git a/go/ssa/testdata/src/encoding/encoding.go b/go/ssa/testdata/src/encoding/encoding.go new file mode 100644 index 000000000..3fa2ba36c --- /dev/null +++ b/go/ssa/testdata/src/encoding/encoding.go @@ -0,0 +1,9 @@ +package encoding + +type BinaryMarshaler interface { + MarshalBinary() (data []byte, err error) +} + +type BinaryUnmarshaler interface { + UnmarshalBinary(data []byte) error +} diff --git a/go/ssa/testdata/src/encoding/json/json.go b/go/ssa/testdata/src/encoding/json/json.go new file mode 100644 index 000000000..2080fc8cb --- /dev/null +++ b/go/ssa/testdata/src/encoding/json/json.go @@ -0,0 +1,4 @@ +package json + +func Marshal(v any) ([]byte, error) +func Unmarshal(data []byte, v any) error diff --git a/go/ssa/testdata/src/encoding/xml/xml.go b/go/ssa/testdata/src/encoding/xml/xml.go new file mode 100644 index 000000000..b226144b6 --- /dev/null +++ b/go/ssa/testdata/src/encoding/xml/xml.go @@ -0,0 +1,4 @@ +package xml + +func Marshal(v any) ([]byte, error) +func Unmarshal(data []byte, v any) error diff --git a/go/ssa/testdata/src/errors/errors.go b/go/ssa/testdata/src/errors/errors.go new file mode 100644 index 000000000..5b292709f --- /dev/null +++ b/go/ssa/testdata/src/errors/errors.go @@ -0,0 +1,3 @@ +package errors + +func New(text string) error diff --git a/go/ssa/testdata/src/fmt/fmt.go b/go/ssa/testdata/src/fmt/fmt.go new file mode 100644 index 000000000..cacfeef20 --- /dev/null +++ b/go/ssa/testdata/src/fmt/fmt.go @@ -0,0 +1,11 @@ +package fmt + +func Sprint(args ...interface{}) string +func Sprintln(args ...interface{}) string +func Sprintf(format string, args ...interface{}) string + +func Print(args ...interface{}) (int, error) +func Println(args ...interface{}) +func Printf(format string, args ...interface{}) (int, error) + +func Errorf(format string, args ...interface{}) error diff --git a/go/ssa/testdata/src/io/io.go b/go/ssa/testdata/src/io/io.go new file mode 100644 index 000000000..8cde43061 --- /dev/null +++ b/go/ssa/testdata/src/io/io.go @@ -0,0 +1,5 @@ +package io + +import "errors" + +var EOF = errors.New("EOF") diff --git a/go/ssa/testdata/src/log/log.go b/go/ssa/testdata/src/log/log.go new file mode 100644 index 000000000..4ff0d8ea9 --- /dev/null +++ b/go/ssa/testdata/src/log/log.go @@ -0,0 +1,5 @@ +package log + +func Println(v ...interface{}) +func Fatalln(v ...interface{}) +func Fatalf(format string, v ...any) diff --git a/go/ssa/testdata/src/math/math.go b/go/ssa/testdata/src/math/math.go new file mode 100644 index 000000000..9768a56ef --- /dev/null +++ b/go/ssa/testdata/src/math/math.go @@ -0,0 +1,15 @@ +package math + +func NaN() float64 + +func Inf(int) float64 + +func IsNaN(float64) bool + +func Float64bits(float64) uint64 + +func Signbit(x float64) bool + +func Sqrt(x float64) float64 + +func Sin(x float64) float64 diff --git a/go/ssa/testdata/src/os/os.go b/go/ssa/testdata/src/os/os.go new file mode 100644 index 000000000..555ef5491 --- /dev/null +++ b/go/ssa/testdata/src/os/os.go @@ -0,0 +1,5 @@ +package os + +func Getenv(string) string + +func Exit(int) diff --git a/go/ssa/testdata/src/reflect/reflect.go b/go/ssa/testdata/src/reflect/reflect.go new file mode 100644 index 000000000..f5d7ba2a0 --- /dev/null +++ b/go/ssa/testdata/src/reflect/reflect.go @@ -0,0 +1,40 @@ +package reflect + +type Type interface { + Elem() Type + Kind() Kind + String() string +} + +type Value struct{} + +func (Value) String() string +func (Value) Elem() Value +func (Value) Field(int) Value +func (Value) Index(i int) Value +func (Value) Int() int64 +func (Value) Interface() interface{} +func (Value) IsNil() bool +func (Value) IsValid() bool +func (Value) Kind() Kind +func (Value) Len() int +func (Value) MapIndex(Value) Value +func (Value) MapKeys() []Value +func (Value) NumField() int +func (Value) Pointer() uintptr +func (Value) SetInt(int64) +func (Value) Type() Type + +func SliceOf(Type) Type +func TypeOf(interface{}) Type +func ValueOf(interface{}) Value + +type Kind uint + +const ( + Invalid Kind = iota + Int + Pointer +) + +func DeepEqual(x, y interface{}) bool diff --git a/go/ssa/testdata/src/runtime/runtime.go b/go/ssa/testdata/src/runtime/runtime.go new file mode 100644 index 000000000..9feed5c99 --- /dev/null +++ b/go/ssa/testdata/src/runtime/runtime.go @@ -0,0 +1,5 @@ +package runtime + +func GC() + +func SetFinalizer(obj, finalizer any) diff --git a/go/ssa/testdata/src/sort/sort.go b/go/ssa/testdata/src/sort/sort.go new file mode 100644 index 000000000..d0b0e9942 --- /dev/null +++ b/go/ssa/testdata/src/sort/sort.go @@ -0,0 +1,13 @@ +package sort + +func Strings(x []string) +func Ints(x []int) +func Float64s(x []float64) + +func Sort(data Interface) + +type Interface interface { + Len() int + Less(i, j int) bool + Swap(i, j int) +} diff --git a/go/ssa/testdata/src/strconv/strconv.go b/go/ssa/testdata/src/strconv/strconv.go new file mode 100644 index 000000000..3f6f8772b --- /dev/null +++ b/go/ssa/testdata/src/strconv/strconv.go @@ -0,0 +1,6 @@ +package strconv + +func Itoa(i int) string +func Atoi(s string) (int, error) + +func FormatFloat(float64, byte, int, int) string diff --git a/go/ssa/testdata/src/strings/strings.go b/go/ssa/testdata/src/strings/strings.go new file mode 100644 index 000000000..11695a43c --- /dev/null +++ b/go/ssa/testdata/src/strings/strings.go @@ -0,0 +1,13 @@ +package strings + +func Replace(s, old, new string, n int) string +func Index(haystack, needle string) int +func Contains(haystack, needle string) bool +func HasPrefix(s, prefix string) bool +func EqualFold(s, t string) bool +func ToLower(s string) string + +type Builder struct{} + +func (b *Builder) WriteString(s string) (int, error) +func (b *Builder) String() string diff --git a/go/ssa/testdata/src/sync/atomic/atomic.go b/go/ssa/testdata/src/sync/atomic/atomic.go new file mode 100644 index 000000000..6080435b2 --- /dev/null +++ b/go/ssa/testdata/src/sync/atomic/atomic.go @@ -0,0 +1,5 @@ +package atomic + +import "unsafe" + +func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) diff --git a/go/ssa/testdata/src/sync/sync.go b/go/ssa/testdata/src/sync/sync.go new file mode 100644 index 000000000..8e6ff6893 --- /dev/null +++ b/go/ssa/testdata/src/sync/sync.go @@ -0,0 +1,12 @@ +package sync + +type Mutex struct{} + +func (m *Mutex) Lock() +func (m *Mutex) Unlock() + +type WaitGroup struct{} + +func (wg *WaitGroup) Add(delta int) +func (wg *WaitGroup) Done() +func (wg *WaitGroup) Wait() diff --git a/go/ssa/testdata/src/time/time.go b/go/ssa/testdata/src/time/time.go new file mode 100644 index 000000000..d8d577d61 --- /dev/null +++ b/go/ssa/testdata/src/time/time.go @@ -0,0 +1,24 @@ +package time + +type Duration int64 + +func Sleep(Duration) + +func NewTimer(d Duration) *Timer + +type Timer struct { + C <-chan Time +} + +func (t *Timer) Stop() bool + +type Time struct{} + +func After(d Duration) <-chan Time + +const ( + Nanosecond Duration = iota // Specific values do not matter here. + Second + Minute + Hour +) diff --git a/go/ssa/testdata/src/unsafe/unsafe.go b/go/ssa/testdata/src/unsafe/unsafe.go new file mode 100644 index 000000000..5fd90b6f0 --- /dev/null +++ b/go/ssa/testdata/src/unsafe/unsafe.go @@ -0,0 +1,4 @@ +package unsafe + +// Empty unsafe package helps other packages load. +// TODO(taking): determine why. |