Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for AssertObjEqual (0.24 sec)

  1. tests/helper_test.go

    			t.Fatalf("errors happened when query: %v", err)
    		} else {
    			AssertObjEqual(t, newPet, pet, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "UserID", "Name")
    			AssertObjEqual(t, newPet, expect, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "UserID", "Name")
    		}
    	}
    
    	AssertObjEqual(t, pet, expect, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "UserID", "Name")
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  2. schema/constraint_test.go

    		},
    	}
    	for k, result := range results {
    		v, ok := constraints[k]
    		if !ok {
    			t.Errorf("Failed to found unique constraint %v from parsed constraints %+v", k, constraints)
    		}
    		tests.AssertObjEqual(t, result, v, "Name")
    		tests.AssertObjEqual(t, result.Field, v.Field, "Name", "Unique", "UniqueIndex")
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  3. utils/tests/utils.go

    package tests
    
    import (
    	"database/sql/driver"
    	"fmt"
    	"go/ast"
    	"reflect"
    	"testing"
    	"time"
    
    	"gorm.io/gorm/utils"
    )
    
    func AssertObjEqual(t *testing.T, r, e interface{}, names ...string) {
    	for _, name := range names {
    		rv := reflect.Indirect(reflect.ValueOf(r))
    		ev := reflect.Indirect(reflect.ValueOf(e))
    		if rv.IsValid() != ev.IsValid() {
    			t.Errorf("%v: expect: %+v, got %+v", utils.FileWithLineNum(), r, e)
    			return
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  4. schema/schema_helper_test.go

    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    func checkSchema(t *testing.T, s *schema.Schema, v schema.Schema, primaryFields []string) {
    	t.Run("CheckSchema/"+s.Name, func(t *testing.T) {
    		tests.AssertObjEqual(t, s, v, "Name", "Table")
    
    		for idx, field := range primaryFields {
    			var found bool
    			for _, f := range s.PrimaryFields {
    				if f.Name == field {
    					found = true
    				}
    			}
    
    			if idx == 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  5. tests/distinct_test.go

    		{Name: "distinct-3", Age: 18},
    	}
    
    	if len(results) != 4 {
    		t.Fatalf("invalid results length found, expects: %v, got %v", len(expects), len(results))
    	}
    
    	for idx, expect := range expects {
    		AssertObjEqual(t, results[idx], expect, "Name", "Age")
    	}
    
    	var count int64
    	if err := DB.Model(&User{}).Where("name like ?", "distinct%").Count(&count).Error; err != nil || count != 5 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  6. tests/customize_field_test.go

    			FieldIgnore:      name + "_allow_ignore",
    		}
    	}
    
    	create := generateStruct("create")
    	DB.Create(&create)
    
    	var result CustomizeFieldStruct
    	DB.Find(&result, "name = ?", "create")
    
    	AssertObjEqual(t, result, create, "Name", "FieldAllowCreate", "FieldAllowSave", "FieldAllowSave2")
    
    	if result.FieldAllowUpdate != "" || result.FieldReadonly != "" || result.FieldIgnore != "" || result.FieldAllowSave3 != "" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  7. schema/index_test.go

    				return
    			}
    			tests.AssertObjEqual(t, ai, ei, "Name", "Class", "Type", "Where", "Comment", "Option")
    			if len(ei.Fields) != len(ai.Fields) {
    				t.Errorf("expected index %q field length is %d but actual %d", k, len(ei.Fields), len(ai.Fields))
    				return
    			}
    			for i, ef := range ei.Fields {
    				af := ai.Fields[i]
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
Back to top