You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dsc_lib/src/functions/index_of.rs
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -60,56 +60,56 @@ mod tests {
60
60
fnfind_string_in_array(){
61
61
letmut parser = Statement::new().unwrap();
62
62
let result = parser.parse_and_execute("[indexOf(createArray('apple', 'banana', 'cherry'), 'banana')]",&Context::new()).unwrap();
63
-
assert_eq!(result.to_string(),"1");
63
+
assert_eq!(result,1);
64
64
}
65
65
66
66
#[test]
67
67
fnfind_number_in_array(){
68
68
letmut parser = Statement::new().unwrap();
69
69
let result = parser.parse_and_execute("[indexOf(createArray(10, 20, 30), 20)]",&Context::new()).unwrap();
70
-
assert_eq!(result.to_string(),"1");
70
+
assert_eq!(result,1);
71
71
}
72
72
73
73
#[test]
74
74
fnfind_first_occurrence(){
75
75
letmut parser = Statement::new().unwrap();
76
76
let result = parser.parse_and_execute("[indexOf(createArray('a', 'b', 'a', 'c'), 'a')]",&Context::new()).unwrap();
77
-
assert_eq!(result.to_string(),"0");
77
+
assert_eq!(result,0);
78
78
}
79
79
80
80
#[test]
81
81
fnitem_not_found(){
82
82
letmut parser = Statement::new().unwrap();
83
83
let result = parser.parse_and_execute("[indexOf(createArray('apple', 'banana'), 'orange')]",&Context::new()).unwrap();
84
-
assert_eq!(result.to_string(),"-1");
84
+
assert_eq!(result, -1);
85
85
}
86
86
87
87
#[test]
88
88
fncase_sensitive_string(){
89
89
letmut parser = Statement::new().unwrap();
90
90
let result = parser.parse_and_execute("[indexOf(createArray('Apple', 'Banana'), 'apple')]",&Context::new()).unwrap();
91
-
assert_eq!(result.to_string(),"-1");
91
+
assert_eq!(result, -1);
92
92
}
93
93
94
94
#[test]
95
95
fnfind_array_in_array(){
96
96
letmut parser = Statement::new().unwrap();
97
97
let result = parser.parse_and_execute("[indexOf(array(createArray('a', 'b'), createArray('c', 'd')), createArray('c', 'd'))]",&Context::new()).unwrap();
98
-
assert_eq!(result.to_string(),"1");
98
+
assert_eq!(result,1);
99
99
}
100
100
101
101
#[test]
102
102
fnfind_object_in_array(){
103
103
letmut parser = Statement::new().unwrap();
104
104
let result = parser.parse_and_execute("[indexOf(array(createObject('name', 'John'), createObject('name', 'Jane')), createObject('name', 'Jane'))]",&Context::new()).unwrap();
105
-
assert_eq!(result.to_string(),"1");
105
+
assert_eq!(result,1);
106
106
}
107
107
108
108
#[test]
109
109
fnempty_array(){
110
110
letmut parser = Statement::new().unwrap();
111
111
let result = parser.parse_and_execute("[indexOf(createArray(), 'test')]",&Context::new()).unwrap();
0 commit comments