2018-02-15 17:14:05 +08:00
|
|
|
package vals
|
2018-01-25 09:40:15 +08:00
|
|
|
|
|
|
|
import (
|
2021-06-16 02:22:38 +08:00
|
|
|
"math/big"
|
2018-01-25 09:40:15 +08:00
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2021-01-27 09:28:38 +08:00
|
|
|
. "src.elv.sh/pkg/tt"
|
2018-01-25 09:40:15 +08:00
|
|
|
)
|
|
|
|
|
2018-02-01 00:36:01 +08:00
|
|
|
type xtype int
|
|
|
|
|
2018-01-25 09:40:15 +08:00
|
|
|
func TestKind(t *testing.T) {
|
2020-01-07 07:14:51 +08:00
|
|
|
Test(t, Fn("Kind", Kind), Table{
|
2019-04-08 05:49:28 +08:00
|
|
|
Args(nil).Rets("nil"),
|
2018-01-27 23:58:27 +08:00
|
|
|
Args(true).Rets("bool"),
|
|
|
|
Args("").Rets("string"),
|
2021-06-16 02:22:38 +08:00
|
|
|
Args(1).Rets("number"),
|
|
|
|
Args(bigInt(z)).Rets("number"),
|
|
|
|
Args(big.NewRat(1, 2)).Rets("number"),
|
2020-04-26 22:38:09 +08:00
|
|
|
Args(1.0).Rets("number"),
|
2019-04-19 21:25:15 +08:00
|
|
|
Args(os.Stdin).Rets("file"),
|
2018-01-29 22:36:43 +08:00
|
|
|
Args(EmptyList).Rets("list"),
|
|
|
|
Args(EmptyMap).Rets("map"),
|
2019-04-20 00:40:45 +08:00
|
|
|
|
2018-02-15 17:14:05 +08:00
|
|
|
Args(xtype(0)).Rets("!!vals.xtype"),
|
2018-02-01 00:36:01 +08:00
|
|
|
|
2019-04-19 21:25:15 +08:00
|
|
|
Args(os.Stdin).Rets("file"),
|
2018-01-25 09:40:15 +08:00
|
|
|
})
|
|
|
|
}
|