Quellcode durchsuchen

feat(plugin): update extension test for embeded functions

ngjaying vor 5 Jahren
Ursprung
Commit
a549ad75b3
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      xsql/processors/extension_test.go

+ 6 - 1
xsql/processors/extension_test.go

@@ -52,7 +52,7 @@ func TestExtensions(t *testing.T) {
 	}{
 	}{
 		{
 		{
 			name: `$$test1`,
 			name: `$$test1`,
-			rj:   "{\"sql\": \"SELECT echo(count) as e, countPlusOne(count) as p FROM ext where count > 49\",\"actions\": [{\"file\":  {\"path\":\"" + CACHE_FILE + "\"}}]}",
+			rj:   "{\"sql\": \"SELECT count(echo(count)) as c, echo(count) as e, countPlusOne(count) as p FROM ext where count > 49\",\"actions\": [{\"file\":  {\"path\":\"" + CACHE_FILE + "\"}}]}",
 		},
 		},
 	}
 	}
 	fmt.Printf("The test bucket size is %d.\n\n", len(tests))
 	fmt.Printf("The test bucket size is %d.\n\n", len(tests))
@@ -105,6 +105,11 @@ func TestExtensions(t *testing.T) {
 				break
 				break
 			}
 			}
 			r := r[0]
 			r := r[0]
+			c := int((r["c"]).(float64))
+			if c != 1 {
+				t.Errorf("%d. %q\n\nresult mismatch:\n\ngot=%#v\n\n", i, tt.rj, maps)
+				break
+			}
 			e := int((r["e"]).(float64))
 			e := int((r["e"]).(float64))
 			if e != 50 && e != 51 {
 			if e != 50 && e != 51 {
 				t.Errorf("%d. %q\n\nresult mismatch:\n\ngot=%#v\n\n", i, tt.rj, maps)
 				t.Errorf("%d. %q\n\nresult mismatch:\n\ngot=%#v\n\n", i, tt.rj, maps)