/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
util/gvalid/gvalid_z_unit_feature_ci_test.go
29 строк
765 B
John Guo
improve package gvalid
03 дек 2021, 19:11
03 дек 2021, 19:11
0da5535
Код
Авторство
О чём код?
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gvalid_test import ( "testing" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/test/gtest" ) func Test_CI(t *testing.T) { gtest.C(t, func(t *gtest.T) { err := g.Validator().Data("id").Rules("in:Id,Name").Run(ctx) t.AssertNE(err, nil) }) gtest.C(t, func(t *gtest.T) { err := g.Validator().Data("id").Rules("ci|in:Id,Name").Run(ctx) t.AssertNil(err) }) gtest.C(t, func(t *gtest.T) { err := g.Validator().Ci().Rules("in:Id,Name").Data("id").Run(ctx) t.AssertNil(err) }) }