Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for AssertObjEqual (0.26 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 Apr 21 09:35:09 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  3. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  4. tests/scanner_valuer_test.go

    	}
    
    	if result.ExampleStruct.Val != "value1" {
    		t.Errorf(`ExampleStruct.Val should equal to "value1", but got %#v`, result.ExampleStruct)
    	}
    	AssertObjEqual(t, data, result, "Name", "Gender", "Age", "Male", "Height", "Birthday", "Password", "Bytes", "Num", "Strings", "Structs")
    }
    
    func TestScannerValuerWithFirstOrCreate(t *testing.T) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  5. tests/update_test.go

    		return result2.Toys[i].ID < result2.Toys[j].ID
    	})
    
    	AssertObjEqual(t, result2, result, "Name", "Account", "Toys", "Manager", "ManagerID", "Languages")
    
    	DB.Model(&result).Select("Name", "Age").Updates(User{Name: "update_with_select"})
    	if result.Age != 0 || result.Name != "update_with_select" {
    		t.Fatalf("Failed to update struct with select, got %+v", result)
    	}
    	AssertObjEqual(t, result, user, "UpdatedAt")
    
    	var result3 User
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  6. tests/associations_test.go

    	parent.FavChildID = child.ID
    	parent.FavChild = &child
    	DB.Save(&parent)
    
    	var parent1 Parent
    	DB.First(&parent1, parent.ID)
    	AssertObjEqual(t, parent, parent1, "ID", "FavChildID")
    
    	// Save and Updates is the same
    	DB.Updates(&parent)
    	DB.First(&parent1, parent.ID)
    	AssertObjEqual(t, parent, parent1, "ID", "FavChildID")
    }
    
    func TestSaveHasManyCircularReference(t *testing.T) {
    	parent := Parent{}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  7. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  8. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  9. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  10. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
Back to top