File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -2577,3 +2577,57 @@ func TestSigArgsEmpty(t *testing.T) {
2577
2577
t .Error (str )
2578
2578
}
2579
2579
}
2580
+
2581
+ func TestDataArgs (t * testing.T ) {
2582
+ input := `["0x0123"]`
2583
+ expected := new (NewDataArgs )
2584
+ expected .Data = "0x0123"
2585
+
2586
+ args := new (NewDataArgs )
2587
+ if err := json .Unmarshal ([]byte (input ), & args ); err != nil {
2588
+ t .Error (err )
2589
+ }
2590
+
2591
+ if expected .Data != args .Data {
2592
+ t .Errorf ("Data should be %v but is %v" , expected .Data , args .Data )
2593
+ }
2594
+ }
2595
+
2596
+ func TestDataArgsEmptyData (t * testing.T ) {
2597
+ input := `[""]`
2598
+
2599
+ args := new (NewDataArgs )
2600
+ str := ExpectValidationError (json .Unmarshal ([]byte (input ), args ))
2601
+ if len (str ) > 0 {
2602
+ t .Error (str )
2603
+ }
2604
+ }
2605
+
2606
+ func TestDataArgsDataType (t * testing.T ) {
2607
+ input := `[13]`
2608
+
2609
+ args := new (NewDataArgs )
2610
+ str := ExpectInvalidTypeError (json .Unmarshal ([]byte (input ), args ))
2611
+ if len (str ) > 0 {
2612
+ t .Error (str )
2613
+ }
2614
+ }
2615
+
2616
+ func TestDataArgsEmpty (t * testing.T ) {
2617
+ input := `[]`
2618
+ args := new (NewDataArgs )
2619
+ str := ExpectInsufficientParamsError (json .Unmarshal ([]byte (input ), args ))
2620
+ if len (str ) > 0 {
2621
+ t .Error (str )
2622
+ }
2623
+ }
2624
+
2625
+ func TestDataArgsInvalid (t * testing.T ) {
2626
+ input := `{}`
2627
+
2628
+ args := new (NewDataArgs )
2629
+ str := ExpectDecodeParamError (json .Unmarshal ([]byte (input ), args ))
2630
+ if len (str ) > 0 {
2631
+ t .Error (str )
2632
+ }
2633
+ }
You can’t perform that action at this time.
0 commit comments