Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 30 for AssertEqual (0.17 sec)

  1. utils/utils.go

    	}
    
    	return strings.Join(results, "_")
    }
    
    func Contains(elems []string, elem string) bool {
    	for _, e := range elems {
    		if elem == e {
    			return true
    		}
    	}
    	return false
    }
    
    func AssertEqual(x, y interface{}) bool {
    	if reflect.DeepEqual(x, y) {
    		return true
    	}
    	if x == nil || y == nil {
    		return false
    	}
    
    	xval := reflect.ValueOf(x)
    	yval := reflect.ValueOf(y)
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  2. statement.go

    			if mv, mok := stmt.Dest.(map[string]interface{}); mok {
    				if fv, ok := mv[field.Name]; ok {
    					return !utils.AssertEqual(fv, fieldValue)
    				} else if fv, ok := mv[field.DBName]; ok {
    					return !utils.AssertEqual(fv, fieldValue)
    				}
    			} else {
    				destValue := reflect.ValueOf(stmt.Dest)
    				for destValue.Kind() == reflect.Ptr {
    					destValue = destValue.Elem()
    				}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 24 09:42:59 UTC 2024
    - 19.9K bytes
    - Viewed (0)
  3. tests/table_test.go

    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	AssertEqual(t, r.Statement.Vars, []interface{}{2, 4, 1, 3})
    }
    
    func TestTableWithAllFields(t *testing.T) {
    	dryDB := DB.Session(&gorm.Session{DryRun: true, QueryFields: true})
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Mar 09 09:31:28 UTC 2024
    - 10.6K bytes
    - Viewed (0)
  4. tests/scan_test.go

    	}
    
    	personDupField := Person{ID: person1.ID}
    	if err := DB.Select("people.id, people.*").
    		First(&personDupField).Error; err != nil {
    		t.Errorf("Failed to run join query, got error: %v", err)
    	}
    	AssertEqual(t, person1, personDupField)
    
    	user := User{
    		Name: "TestScanToEmbedded_1",
    		Manager: &User{
    			Name:    "TestScanToEmbedded_1_m1",
    			Manager: &User{Name: "TestScanToEmbedded_1_m1_m1"},
    		},
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 12 10:57:36 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  5. tests/hooks_test.go

    	if product.Name != "Product New3" || product.Price != 220 || product.Code != "L1213" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    	var result Product3
    	DB.First(&result, product.ID)
    
    	AssertEqual(t, result, product)
    
    	// Select to change Code, but nothing updated, price should not change
    	DB.Model(&product).Select("code").Updates(Product3{Name: "L1214", Code: "L1213"})
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 17 03:59:06 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  6. schema/schema_helper_test.go

    	for k, v := range values {
    		t.Run("CheckField/"+k, func(t *testing.T) {
    			fv, _ := s.FieldsByDBName[k].ValueOf(context.Background(), value)
    			tests.AssertEqual(t, v, fv)
    		})
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Fri Dec 15 08:31:23 UTC 2023
    - 7.5K bytes
    - Viewed (0)
  7. tests/customize_field_test.go

    	var result4 CustomizeFieldStruct
    	if err := DB.First(&result4, "field_allow_save3 = ?", create.FieldAllowSave3).Error; err != nil {
    		t.Fatalf("failed to query with inserted field, got error %v", err)
    	}
    
    	AssertEqual(t, result3, result4)
    
    	createWithDefaultTime := generateStruct("create_with_default_time")
    	createWithDefaultTime.AutoUnixCreateTime = 100
    	createWithDefaultTime.AutoUnixUpdateTime = 100
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Fri Sep 11 09:33:31 UTC 2020
    - 6.9K bytes
    - Viewed (0)
  8. tests/scanner_valuer_test.go

    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("newpass")).Error; err != nil {
    		t.Errorf("Should got no error update data with valid data, but got %v", err)
    	}
    
    	AssertEqual(t, data.Password, EncryptedData("newpass"))
    }
    
    type ScannerValuerStruct struct {
    	gorm.Model
    	Name             sql.NullString
    	Gender           *sql.NullString
    	Age              sql.NullInt64
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 07 07:02:07 UTC 2023
    - 10.6K bytes
    - Viewed (0)
  9. tests/delete_test.go

    	DB.Table("deleted_users").Create(&user)
    
    	var result UserWithDelete
    	if err := DB.Table("deleted_users").First(&result).Error; err != nil {
    		t.Errorf("failed to find deleted user, got error %v", err)
    	}
    
    	AssertEqual(t, result, user)
    
    	if err := DB.Table("deleted_users").Delete(&result).Error; err != nil {
    		t.Errorf("failed to delete user, got error %v", err)
    	}
    
    	var result2 UserWithDelete
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Tue Oct 10 07:03:34 UTC 2023
    - 9.4K bytes
    - Viewed (0)
  10. tests/multi_primary_keys_test.go

    		},
    	}
    
    	DB.Create(&book)
    
    	var result Book
    	if err := DB.Preload("Labels").First(&result, book.ID).Error; err != nil {
    		t.Fatalf("failed to preload, got error %v", err)
    	}
    
    	AssertEqual(t, book, result)
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 12.8K bytes
    - Viewed (0)
Back to top