Skip to content

Commit

Permalink
fix echo variable (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Defined2014 authored Dec 7, 2023
1 parent 17b728e commit c5cf84a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions generate_perror/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strconv"
Expand Down
1 change: 1 addition & 0 deletions r/example.result
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ info:
INSERT t1 VALUES (1, 1), (1, 1) ON DUPLICATE KEY UPDATE f1 = 2, f2 = 2;
affected rows: 3
info: Records: 2 Duplicates: 1 Warnings: 0
1
use `test`;;
2 changes: 1 addition & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (t *tester) Run() error {
case Q_ERROR:
t.expectedErrs = strings.Split(strings.TrimSpace(s), ",")
case Q_ECHO:
varSearch := regexp.MustCompile(`\\$([A-Za-z0-9_]+)( |$)`)
varSearch := regexp.MustCompile(`\$([A-Za-z0-9_]+)( |$)`)
s := varSearch.ReplaceAllStringFunc(s, func(s string) string {
return os.Getenv(varSearch.FindStringSubmatch(s)[1])
})
Expand Down
3 changes: 3 additions & 0 deletions t/example.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ INSERT t1 VALUES (1, 1);
INSERT t1 VALUES (1, 1), (1, 1) ON DUPLICATE KEY UPDATE f1 = 2, f2 = 2;
--disable_info

--let $a=`select 1`
--echo $a

use `test`;;

0 comments on commit c5cf84a

Please sign in to comment.