Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for expected (0.17 sec)

  1. tests/associations_has_many_test.go

    	}
    
    	if count := tx.Model(&item).Association("Contents").Count(); count != 3 {
    		t.Errorf("expected %d contents, got %d", 3, count)
    	}
    
    	var contents []ItemContent
    	if err := tx.Find(&contents).Error; err != nil {
    		t.Errorf("failed to find contents, got error: %v", err)
    	}
    	if len(contents) != 3 {
    		t.Errorf("expected %d contents, got %d", 3, len(contents))
    	}
    
    	// test delete
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  2. callbacks/helper_test.go

    				"active": true,
    			},
    			expect: clause.Values{
    				Columns: []clause.Column{{Name: "active"}},
    				Values:  [][]interface{}{{true}},
    			},
    		},
    	}
    
    	for _, tc := range testCase {
    		t.Run(tc.name, func(t *testing.T) {
    			actual := ConvertMapToValuesForCreate(&gorm.Statement{}, tc.input)
    			if !reflect.DeepEqual(actual, tc.expect) {
    				t.Errorf("expect %v got %v", tc.expect, actual)
    			}
    		})
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  3. callbacks/create_test.go

    	values := ConvertToCreateValues(stmt)
    	expected := clause.Values{
    		// column has value + defaultValue column has value (which should have a stable order)
    		Columns: []clause.Column{{Name: "name"}, {Name: "email"}, {Name: "age"}, {Name: "id"}},
    		Values: [][]interface{}{
    			{"alice", "email", 18, 1},
    			{"bob", "email", 19, 2},
    		},
    	}
    	if !reflect.DeepEqual(expected, values) {
    		t.Errorf("expected: %v got %v", expected, values)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  4. tests/scopes_test.go

    		name     string
    		queryFn  func(tx *gorm.DB) *gorm.DB
    		expected string
    	}{
    		{
    			name: "depth_1",
    			queryFn: func(tx *gorm.DB) *gorm.DB {
    				return tx.Scopes(
    					func(d *gorm.DB) *gorm.DB { return d.Where("a = 1") },
    					func(d *gorm.DB) *gorm.DB {
    						return d.Where(DB.Or("b = 2").Or("c = 3"))
    					},
    				).Find(&Language{})
    			},
    			expected: `SELECT * FROM "languages" WHERE a = 1 AND (b = 2 OR c = 3)`,
    		}, {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  5. schema/relationship_test.go

    		t.Fatalf("expects 1 relations, but got %v", len(userSchema.Relationships.Relations))
    	}
    
    	if createdByRel, ok := userSchema.Relationships.Relations["CreatedBy"]; ok {
    		if createdByRel.FieldSchema != userSchema {
    			t.Fatalf("expects same field schema, but got new %p, old %p", createdByRel.FieldSchema, userSchema)
    		}
    	} else {
    		t.Fatalf("expects created by relations, but not found")
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  6. schema/schema_helper_test.go

    }
    
    func checkEmbeddedRelations(t *testing.T, actual map[string]*schema.Relationships, expected map[string]EmbeddedRelations) {
    	for name, relations := range actual {
    		rs := expected[name]
    		t.Run("CheckEmbeddedRelations/"+name, func(t *testing.T) {
    			if len(relations.Relations) != len(rs.Relations) {
    				t.Errorf("schema relations count don't match, expects %d, got %d", len(rs.Relations), len(relations.Relations))
    			}
    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)
  7. logger/sql.go

    		return true
    	case reflect.Float32, reflect.Float64:
    		return true
    	default:
    		return false
    	}
    }
    
    // ExplainSQL generate SQL string with given parameters, the generated SQL is expected to be used in logger, execute it might introduce a SQL injection vulnerability
    func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string {
    	var (
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  8. tests/migrate_test.go

    	}
    
    	if tableType.Schema() != tblSchema {
    		t.Fatalf("expected tblSchema to be %s but got %s", tblSchema, tableType.Schema())
    	}
    
    	if tableType.Name() != tblName {
    		t.Fatalf("expected table name to be %s but got %s", tblName, tableType.Name())
    	}
    
    	if tableType.Type() != tblType {
    		t.Fatalf("expected table type to be %s but got %s", tblType, tableType.Type())
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  9. schema/index_test.go

    				{Field: &schema.Field{Name: "FieldH2"}},
    			},
    		},
    	}, indices)
    }
    
    func CheckIndices(t *testing.T, expected, actual map[string]schema.Index) {
    	for k, ei := range expected {
    		t.Run(k, func(t *testing.T) {
    			ai, ok := actual[k]
    			if !ok {
    				t.Errorf("expected index %q but actual missing", k)
    				return
    			}
    			tests.AssertObjEqual(t, ai, ei, "Name", "Class", "Type", "Where", "Comment", "Option")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  10. logger/sql_test.go

    		},
    	}
    
    	for idx, r := range results {
    		if result := logger.ExplainSQL(r.SQL, r.NumericRegexp, `"`, r.Vars...); result != r.Result {
    			t.Errorf("Explain SQL #%v expects %v, but got %v", idx, r.Result, result)
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 8.4K bytes
    - Viewed (0)
Back to top