mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-27 23:11:20 +08:00
pkg/prog: Bump deprecation level to 20.
Also add support for setting deprecation level in transcript tests.
This commit is contained in:
parent
7e0b6ee8e6
commit
c9e26cc20f
|
@ -102,6 +102,8 @@ Exception: port does not support value output
|
|||
# eawk #
|
||||
////////
|
||||
|
||||
//with-deprecation-level 19
|
||||
|
||||
~> echo " ax by cz \n11\t22 33" | eawk {|@a| put $a[-1] }
|
||||
▶ cz
|
||||
▶ 33
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"io/fs"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -18,6 +19,7 @@ import (
|
|||
"src.elv.sh/pkg/mods"
|
||||
"src.elv.sh/pkg/must"
|
||||
"src.elv.sh/pkg/parse"
|
||||
"src.elv.sh/pkg/prog"
|
||||
"src.elv.sh/pkg/testutil"
|
||||
"src.elv.sh/pkg/transcript"
|
||||
)
|
||||
|
@ -68,6 +70,8 @@ import (
|
|||
// and GOOS values and "unix" are recognized as tags; other tags are always
|
||||
// false.
|
||||
//
|
||||
// - deprecation-level $x: Run with deprecation level set to $x.
|
||||
//
|
||||
// Since directives in a higher level propagated to all its descendants, this
|
||||
// mechanism can be used to specify setup functions that apply to an entire
|
||||
// .elvts file (or an entire elvish-transcript code block in a .elv file) or an
|
||||
|
@ -162,6 +166,9 @@ func buildSetupMaps(setupPairs []any) (map[string]func(*testing.T, *eval.Evaler)
|
|||
t.Skipf("constraint not satisfied: %s", arg)
|
||||
}
|
||||
},
|
||||
"deprecation-level": func(t *testing.T, _ *eval.Evaler, arg string) {
|
||||
testutil.Set(t, &prog.DeprecationLevel, must.OK1(strconv.Atoi(arg)))
|
||||
},
|
||||
}
|
||||
for i := 0; i < len(setupPairs); i += 2 {
|
||||
name := setupPairs[i].(string)
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
// DeprecationLevel is a global flag that controls which deprecations to show.
|
||||
// If its value is X, Elvish shows deprecations that should be shown for version
|
||||
// 0.X.
|
||||
var DeprecationLevel = 19
|
||||
var DeprecationLevel = 20
|
||||
|
||||
// Program represents a subprogram.
|
||||
type Program interface {
|
||||
|
|
Loading…
Reference in New Issue
Block a user