Add flow/flow_test
This commit is contained in:
		
							
								
								
									
										37
									
								
								flow/flow_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								flow/flow_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| package flow | ||||
|  | ||||
| import ( | ||||
| 	"reflect" | ||||
| 	"testing" | ||||
| ) | ||||
|  | ||||
| func TestMarshall(t *testing.T) { | ||||
| 	a := "json" | ||||
| 	res := []byte(a) | ||||
| 	m := RawMessage(a) | ||||
|  | ||||
| 	b, err := m.MarshalJSON() | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Error %s", err) | ||||
| 	} | ||||
|  | ||||
| 	if !reflect.DeepEqual(b, res) { | ||||
| 		t.Errorf("Error %s", err) | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| func TestUnmarshall(t *testing.T) { | ||||
| 	strn := "json" | ||||
| 	b := []byte(strn) | ||||
| 	// exp := string(b) | ||||
| 	m := RawMessage(b) | ||||
|  | ||||
| 	if err := m.UnmarshalJSON(b); err != nil { | ||||
| 		t.Errorf("Error %s", m) | ||||
| 	} | ||||
|  | ||||
| 	if string(m) != strn { | ||||
| 		t.Errorf("Error %s", m) | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user