fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
6d0cd3d9b
master
1# RUN: fish=%fish %fish %s 2 3function provoke-migration 4set -U __fish_initialized3800 5rm -f\ 6$__fish_config_dir /conf.d/fish_frozen_theme.fish\ 7$__fish_config_dir /conf.d/fish_frozen_key_bindings.fish 8end 9 10function fake-old-uvars 11for varnamein ( __fish_theme_variables --universal) 12set $varname ( string match -rv --'--theme=.*' $$varname ) 13end 14end 15 16set -U 17echo no default universal variables 18# CHECK: no default universal variables 19 20# Existing universal variables are migrated as-is. 21{ 22 echo yes | fish_config theme save default-rgb --color-theme=light 23 fake-old-uvars 24 set -U fish_key_bindings fish_vi_key_bindings 25 set -U | head -2 26 # CHECK: fish_color_autosuggestion 7f7f7f 27 # CHECK: fish_color_cancel'ffffff' '--background=000000' 28not path is $__fish_config_dir /conf.d/fish_frozen_theme.fish 29and echo ok 30# CHECK: ok 31 32provoke-migration 33$fish -c __fish_theme_migrate 34# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}} 35# CHECK: {{.*Color.*no.longer.*universal.*}} 36# CHECK: Migrated {{.*}} {{\S*}}/xdg_config_home/fish/conf.d/fish_frozen_theme.fish{{\x1b\[m}} 37# CHECK: {{.*restart.*}} 38# CHECK: {{.*fish_key_bindings.*no.longer.*universal.*}} 39# CHECK: Migrated {{.*}} {{\S*}}/xdg_config_home/fish/conf.d/fish_frozen_key_bindings.fish{{\x1b\[m}} 40# CHECK: {{.*help relnotes.*}} 41grep -v '^#' $__fish_config_dir /conf.d/fish_frozen_theme.fish | grep . | head -3 42# CHECK: set --global fish_color_autosuggestion 7f7f7f 43# CHECK: set --global fish_color_cancel ffffff --background=000000 44# CHECK: set --global fish_color_command 0000ee 45grep -v '^#' $__fish_config_dir /conf.d/fish_frozen_key_bindings.fish 46# CHECK: set --global fish_key_bindings fish_vi_key_bindings 47# CHECK: set --erase --universal fish_key_bindings 48 49# But the migration is only done once, in case the user really wants these as universals. 50set -U fish_color_autosuggestion 8e8e8e 51$fish -c ' 52__fish_theme_migrate 53set -eg fish_color_autosuggestion 54echo $fish_color_autosuggestion 55# CHECK: 8e8e8e 56' 57set -Ue fish_color_autosuggestion 58} 59 60# If existing universal colors match old defaults exactly ( common case), don 't migrate but 61# delete them. 62{ 63echo yes | fish_config theme save default 64fake-old-uvars 65provoke-migration 66$fish -c __fish_theme_migrate 67# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}} 68# CHECK: {{.*Color.*no.longer.*universal.*}} 69# CHECK: {{.*restart.*}} 70# CHECK: {{.*help relnotes.*}} 71not path is $__fish_config_dir/conf.d/fish_frozen_theme.fish 72and echo ok 73# CHECK: ok 74set -U 75# CHECK: __fish_initialized 4300 76} 77 78# Labeled color variables may be updated by fish. 79{ 80$fish -c ' 81fish_config theme choose default 82set -g fish_color_autosuggestion red 83set -g fish_color_command green --theme=default 84__fish_theme_migrate 85for cmd in "" "__fish_color_theme=unknown __fish_apply_theme" 86eval $cmd 87echo fish_color_autosuggestion $fish_color_autosuggestion 88echo fish_color_command $fish_color_command 89end 90# CHECK: fish_color_autosuggestion red 91# CHECK: fish_color_command green --theme=default 92# CHECK: fish_color_autosuggestion red 93# CHECK: fish_color_command --reset --theme=default 94' 95} 96 97# If existing universal key bindings match old defaults exactly (common case), don' t migrate 98# but delete them). 99{ 100set -U fish_key_bindings fish_vi_key_bindings 101provoke-migration 102$fish -c __fish_theme_migrate 103# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}} 104# CHECK: {{.*fish_key_bindings.*no.longer.*universal.*}} 105# CHECK: Migrated {{.*}} {{\S*}}/xdg_config_home/fish/conf.d/fish_frozen_key_bindings.fish{{\x1b\[m}} 106# CHECK: {{.*help relnotes.*}} 107path is $__fish_config_dir /conf.d/fish_frozen_key_bindings.fish 108and echo ok 109# CHECK: ok 110set -U 111# CHECK: __fish_initialized 4300 112} 113 114# Test some historical values for __fish_config_theme_uvars_subset_of_historical_default. 115{ 116provoke-migration 117echo > $__fish_config_dir /fish_variables \ 118'# VERSION: 3.0 119SETUVAR __fish_initialized:0 120SETUVAR fish_color_autosuggestion:555\x1ebrblack 121SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d111 122SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack 123SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di 124SETUVAR fish_pager_color_prefix:cyan\x1e\x2d\x2dbold\x1e\x2d\x2dunderline' 125$fish -c __fish_theme_migrate 126# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}} 127# CHECK: * Color variables are no longer set in universal scope. 128# CHECK: To restore syntax highlighting in other fish sessions, please restart them. 129# CHECK: {{.*help relnotes.*}} 130not path is $__fish_config_dir /conf.d/fish_frozen_theme.fish 131and echo ok 132# CHECK: ok 133set -U 134# CHECK: __fish_initialized 4300 135}