Coverage default.go #330
@@ -31,6 +31,9 @@ func (c *cfg) Validate() error {
 | 
				
			|||||||
	if c.IntValue != 10 {
 | 
						if c.IntValue != 10 {
 | 
				
			||||||
		return fmt.Errorf("invalid IntValue %d != %d", 10, c.IntValue)
 | 
							return fmt.Errorf("invalid IntValue %d != %d", 10, c.IntValue)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if c.MapValue["key1"] != true {
 | 
				
			||||||
 | 
							return fmt.Errorf("invalid MapValue %t != %t", true, c.MapValue["key1"])
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -105,3 +108,19 @@ func TestValidate(t *testing.T) {
 | 
				
			|||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestString(t *testing.T) {
 | 
				
			||||||
 | 
						cfg := config.NewConfig()
 | 
				
			||||||
 | 
						res := cfg.String()
 | 
				
			||||||
 | 
						if res != "default" {
 | 
				
			||||||
 | 
							t.Fatalf("string value invalid: %s", res)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestName(t *testing.T) {
 | 
				
			||||||
 | 
						cfg := config.NewConfig()
 | 
				
			||||||
 | 
						res := cfg.Name()
 | 
				
			||||||
 | 
						if res != "" {
 | 
				
			||||||
 | 
							t.Fatal("name value not empty")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								flow/flow_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								flow/flow_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					package flow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"reflect"
 | 
				
			||||||
 | 
						"testing"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FuzzMarshall(f *testing.F) {
 | 
				
			||||||
 | 
						f.Fuzz(func(t *testing.T, ref []byte) {
 | 
				
			||||||
 | 
							rm := RawMessage(ref)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							b, err := rm.MarshalJSON()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								t.Errorf("Error MarshalJSON: %s", err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if !reflect.DeepEqual(ref, b) {
 | 
				
			||||||
 | 
								t.Errorf("Error. Expected '%s', was '%s'", ref, b)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FuzzUnmarshall(f *testing.F) {
 | 
				
			||||||
 | 
						f.Fuzz(func(t *testing.T, ref string) {
 | 
				
			||||||
 | 
							b := []byte(ref)
 | 
				
			||||||
 | 
							rm := RawMessage(b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if err := rm.UnmarshalJSON(b); err != nil {
 | 
				
			||||||
 | 
								t.Errorf("Error UnmarshalJSON: %s", err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ref != string(rm) {
 | 
				
			||||||
 | 
								t.Errorf("Error. Expected '%s', was '%s'", ref, rm)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user