diff options
| author | Christine Dodrill <me@christine.website> | 2018-08-22 03:17:59 +0000 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2018-08-22 03:17:59 +0000 |
| commit | 6b7d6dcc49c6cbd83af70d97d01b700c8fb0c393 (patch) | |
| tree | 60bd319655e77afb0e3737cc9070d5111a41f22b /vendor/github.com/Xe | |
| parent | 5a8b8dc48f33c44fd41ac27c1fb4185de1d87d41 (diff) | |
| download | xesite-6b7d6dcc49c6cbd83af70d97d01b700c8fb0c393.tar.xz xesite-6b7d6dcc49c6cbd83af70d97d01b700c8fb0c393.zip | |
add analytics via segment again
Diffstat (limited to 'vendor/github.com/Xe')
| -rw-r--r-- | vendor/github.com/Xe/jsonfeed/jsonfeed_test.go | 43 | ||||
| -rw-r--r-- | vendor/github.com/Xe/jsonfeed/testdata/feed.json | 21 | ||||
| -rw-r--r-- | vendor/github.com/Xe/ln/logger_test.go | 111 |
3 files changed, 0 insertions, 175 deletions
diff --git a/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go b/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go deleted file mode 100644 index 29d9165..0000000 --- a/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/ - -package jsonfeed_test - -import ( - "os" - "testing" - "time" - - "github.com/st3fan/jsonfeed" - "github.com/stretchr/testify/assert" -) - -func Test_ParseSimple(t *testing.T) { - r, err := os.Open("testdata/feed.json") - assert.NoError(t, err, "Could not open testdata/feed.json") - - feed, err := jsonfeed.Parse(r) - assert.NoError(t, err, "Could not parse testdata/feed.json") - - assert.Equal(t, "https://jsonfeed.org/version/1", feed.Version) - assert.Equal(t, "JSON Feed", feed.Title) - assert.Equal(t, "JSON Feed is a ...", feed.Description) - assert.Equal(t, "https://jsonfeed.org/", feed.HomePageURL) - assert.Equal(t, "https://jsonfeed.org/feed.json", feed.FeedURL) - assert.Equal(t, "This feed allows ...", feed.UserComment) - assert.Equal(t, "https://jsonfeed.org/graphics/icon.png", feed.Favicon) - assert.Equal(t, "Brent Simmons and Manton Reece", feed.Author.Name) - - assert.Equal(t, 1, len(feed.Items)) - - assert.Equal(t, "https://jsonfeed.org/2017/05/17/announcing_json_feed", feed.Items[0].ID) - assert.Equal(t, "https://jsonfeed.org/2017/05/17/announcing_json_feed", feed.Items[0].URL) - assert.Equal(t, "Announcing JSON Feed", feed.Items[0].Title) - assert.Equal(t, "<p>We ...", feed.Items[0].ContentHTML) - - datePublished, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-05-17T08:02:12-07:00") - assert.NoError(t, err, "Could not parse timestamp") - - assert.Equal(t, datePublished, feed.Items[0].DatePublished) -} diff --git a/vendor/github.com/Xe/jsonfeed/testdata/feed.json b/vendor/github.com/Xe/jsonfeed/testdata/feed.json deleted file mode 100644 index ad4bbe1..0000000 --- a/vendor/github.com/Xe/jsonfeed/testdata/feed.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "https://jsonfeed.org/version/1", - "title": "JSON Feed", - "description": "JSON Feed is a ...", - "home_page_url": "https://jsonfeed.org/", - "feed_url": "https://jsonfeed.org/feed.json", - "user_comment": "This feed allows ...", - "favicon": "https://jsonfeed.org/graphics/icon.png", - "author": { - "name": "Brent Simmons and Manton Reece" - }, - "items": [ - { - "id": "https://jsonfeed.org/2017/05/17/announcing_json_feed", - "url": "https://jsonfeed.org/2017/05/17/announcing_json_feed", - "title": "Announcing JSON Feed", - "content_html": "<p>We ...", - "date_published": "2017-05-17T08:02:12-07:00" - } - ] -} diff --git a/vendor/github.com/Xe/ln/logger_test.go b/vendor/github.com/Xe/ln/logger_test.go deleted file mode 100644 index 800ed90..0000000 --- a/vendor/github.com/Xe/ln/logger_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package ln - -import ( - "bytes" - "context" - "fmt" - "testing" - "time" -) - -var ctx context.Context - -func setup(t *testing.T) (*bytes.Buffer, func()) { - ctx = context.Background() - - out := bytes.Buffer{} - oldFilters := DefaultLogger.Filters - DefaultLogger.Filters = []Filter{NewWriterFilter(&out, nil)} - return &out, func() { - DefaultLogger.Filters = oldFilters - } -} - -func TestSimpleError(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - Log(ctx, F{"err": fmt.Errorf("This is an Error!!!")}, F{"msg": "fooey", "bar": "foo"}) - data := []string{ - `err="This is an Error!!!"`, - `fooey`, - `bar=foo`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -func TestTimeConversion(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - var zeroTime time.Time - - Log(ctx, F{"zero": zeroTime}) - data := []string{ - `zero=0001-01-01T00:00:00Z`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -func TestDebug(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - // set priority to Debug - Error(ctx, fmt.Errorf("This is an Error!!!"), F{}) - - data := []string{ - `err="This is an Error!!!"`, - `_lineno=`, - `_function=ln.TestDebug`, - `_filename=github.com/Xe/ln/logger_test.go`, - `cause="This is an Error!!!"`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -func TestFer(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - underTest := foobar{Foo: 1, Bar: "quux"} - - Log(ctx, underTest) - data := []string{ - `foo=1`, - `bar=quux`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -type foobar struct { - Foo int - Bar string -} - -func (f foobar) F() F { - return F{ - "foo": f.Foo, - "bar": f.Bar, - } -} |
