File: codec.go

package info (click to toggle)
golang-github-juju-qthttptest 0.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid
  • size: 112 kB
  • sloc: makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2012-2014 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.

package qthttptest

import (
	qt "github.com/frankban/quicktest"
	"gopkg.in/mgo.v2/bson"
	yaml "gopkg.in/yaml.v3"
)

// BSONEquals defines a checker that checks whether a byte slice, when
// unmarshaled as BSON, is equal to the given value. Rather than
// unmarshaling into something of the expected body type, we reform
// the expected body in BSON and back to interface{} so we can check
// the whole content. Otherwise we lose information when unmarshaling.
var BSONEquals = qt.CodecEquals(bson.Marshal, bson.Unmarshal)

// JSONEquals defines a checker that checks whether a byte slice, when
// unmarshaled as JSON, is equal to the given value.
// Rather than unmarshaling into something of the expected
// body type, we reform the expected body in JSON and
// back to interface{}, so we can check the whole content.
// Otherwise we lose information when unmarshaling.
//
// Deprecated: use qt.JSONEquals instead.
var JSONEquals = qt.JSONEquals

// YAMLEquals defines a checker that checks whether a byte slice, when
// unmarshaled as YAML, is equal to the given value.
// Rather than unmarshaling into something of the expected
// body type, we reform the expected body in YAML and
// back to interface{}, so we can check the whole content.
// Otherwise we lose information when unmarshaling.
var YAMLEquals = qt.CodecEquals(yaml.Marshal, yaml.Unmarshal)