github.com/icyphox/x@v0.0.355-0.20220311094250-029bd783e8b8/modx/version_test.go (about) 1 package modx 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 "github.com/stretchr/testify/require" 8 ) 9 10 const stub = `module github.com/ory/x 11 12 // remove once https://github.com/seatgeek/logrus-gelf-formatter/pull/5 is merged 13 replace github.com/seatgeek/logrus-gelf-formatter => github.com/zepatrik/logrus-gelf-formatter v0.0.0-20210305135027-b8b3731dba10 14 15 require ( 16 github.com/DataDog/datadog-go v4.0.0+incompatible // indirect 17 github.com/bmatcuk/doublestar/v2 v2.0.3 18 github.com/containerd/containerd v1.4.3 // indirect 19 github.com/dgraph-io/ristretto v0.0.2 20 github.com/docker/distribution v2.7.1+incompatible // indirect 21 github.com/docker/docker v17.12.0-ce-rc1.0.20201201034508-7d75c1d40d88+incompatible 22 github.com/fatih/structs v1.1.0 23 github.com/fsnotify/fsnotify v1.4.9 24 github.com/ghodss/yaml v1.0.0 25 github.com/go-bindata/go-bindata v3.1.1+incompatible 26 github.com/go-openapi/errors v0.20.0 // indirect 27 github.com/go-openapi/runtime v0.19.26 28 github.com/go-sql-driver/mysql v1.5.0 29 github.com/gobuffalo/fizz v1.10.0 30 github.com/gobuffalo/httptest v1.0.2 31 github.com/gobuffalo/packr v1.22.0 32 github.com/gobuffalo/pop/v5 v5.3.1 33 github.com/golang/mock v1.3.1 34 github.com/google/go-jsonnet v0.16.0 35 github.com/google/uuid v1.1.2 36 github.com/gorilla/websocket v1.4.2 37 github.com/hashicorp/go-retryablehttp v0.6.8 38 github.com/inhies/go-bytesize v0.0.0-20201103132853-d0aed0d254f8 39 github.com/jackc/pgconn v1.6.0 40 github.com/jackc/pgx/v4 v4.6.0 41 github.com/jandelgado/gcov2lcov v1.0.4-0.20210120124023-b83752c6dc08 42 github.com/jmoiron/sqlx v1.2.0 43 github.com/julienschmidt/httprouter v1.2.0 44 github.com/knadh/koanf v0.14.1-0.20201201075439-e0853799f9ec 45 github.com/lib/pq v1.3.0 46 github.com/markbates/pkger v0.17.1 47 github.com/morikuni/aec v1.0.0 // indirect 48 github.com/opentracing/opentracing-go v1.2.0 49 github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5 50 github.com/openzipkin/zipkin-go v0.2.2 51 github.com/ory/analytics-go/v4 v4.0.0 52 github.com/ory/dockertest/v3 v3.6.3 53 github.com/ory/go-acc v0.2.6 54 github.com/ory/herodot v0.9.2 55 github.com/ory/jsonschema/v3 v3.0.1 56 github.com/pborman/uuid v1.2.0 57 github.com/pelletier/go-toml v1.8.0 58 github.com/philhofer/fwd v1.0.0 // indirect 59 github.com/pkg/errors v0.9.1 60 github.com/pkg/profile v1.2.1 61 github.com/rs/cors v1.6.0 62 github.com/rubenv/sql-migrate v0.0.0-20190212093014-1007f53448d7 63 github.com/seatgeek/logrus-gelf-formatter v0.0.0-20210219220335-367fa274be2c 64 github.com/sirupsen/logrus v1.6.0 65 github.com/spf13/cast v1.3.2-0.20200723214538-8d17101741c8 66 github.com/spf13/cobra v1.0.0 67 github.com/spf13/pflag v1.0.5 68 github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 69 github.com/stretchr/testify v1.6.1 70 github.com/tidwall/gjson v1.3.2 71 github.com/tidwall/sjson v1.0.4 72 github.com/uber/jaeger-client-go v2.22.1+incompatible 73 github.com/urfave/negroni v1.0.0 74 go.elastic.co/apm v1.8.0 75 go.elastic.co/apm/module/apmot v1.8.0 76 go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.13.0 77 golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 78 gonum.org/v1/plot v0.0.0-20200111075622-4abb28f724d5 79 google.golang.org/grpc v1.36.0 80 gopkg.in/DataDog/dd-trace-go.v1 v1.27.0 81 gopkg.in/square/go-jose.v2 v2.2.2 82 ) 83 84 go 1.16 85 ` 86 87 func TestVersion(t *testing.T) { 88 for _, tc := range [][]string{ 89 {"google.golang.org/grpc", "v1.36.0"}, 90 {"golang.org/x/crypto", "v0.0.0-20200510223506-06a226fb4e37"}, 91 } { 92 93 v, err := FindVersion([]byte(stub), tc[0]) 94 require.NoError(t, err) 95 assert.Equal(t, tc[1], v) 96 97 } 98 99 _, err := FindVersion([]byte(stub), "notgithub.com/idonot/exist") 100 require.Error(t, err) 101 }