From 141c3ec69c32e3733ea390a2ce40b601b1826f6f Mon Sep 17 00:00:00 2001 From: Ewan Chou Date: Tue, 1 Mar 2016 11:41:39 +0800 Subject: [PATCH] ast: add datum_test.go --- ast/datum_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ast/datum_test.go diff --git a/ast/datum_test.go b/ast/datum_test.go new file mode 100644 index 0000000000..13d016c65a --- /dev/null +++ b/ast/datum_test.go @@ -0,0 +1,40 @@ +// Copyright 2016 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package ast + +import ( + . "github.com/pingcap/check" +) + +var _ = Suite(&testDatumSuite{}) + +type testDatumSuite struct { +} + +func (ts *testDatumSuite) TestDatum(c *C) { + values := []interface{}{ + int64(1), + uint64(1), + 1.1, + "abc", + []byte("abc"), + []int{1}, + } + for _, val := range values { + var d Datum + d.SetValue(val) + x := d.GetValue() + c.Assert(x, DeepEquals, val) + } +}