| 1 | //go:build unix |
| 2 | // +build unix |
| 3 | |
| 4 | package tcellscip-go gomod github.com/gdamore/tcell/v3 . `github.com/gdamore/tcell/v3`/ |
| 5 | |
| 6 | import "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 7 | |
| 8 | // Copyright 2026 The TCell Authors |
| 9 | // |
| 10 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | // you may not use this file except in compliance with the License. |
| 12 | // You may obtain a copy of the License at |
| 13 | // |
| 14 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | // |
| 16 | // Unless required by applicable law or agreed to in writing, software |
| 17 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | // See the License for the specific language governing permissions and |
| 20 | // limitations under the License. |
| 21 | |
| 22 | func TestGetCharsetscip-go gomod github.com/gdamore/tcell/v3 . `github.com/gdamore/tcell/v3`/TestGetCharset().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 23 | cases := []struct { |
| 24 | name string |
| 25 | locale string |
| 26 | charset string |
| 27 | }{ |
| 28 | {"POSIX", "POSIX", "US-ASCII"}, |
| 29 | {"C", "C", "US-ASCII"}, |
| 30 | {"C Unicode", "C.UTF-8", "UTF-8"}, |
| 31 | {"Old UK euro", "UK.ISO-8859-1@euro", "ISO-8859-1"}, |
| 32 | {"Unset", "", "UTF-8"}, |
| 33 | } |
| 34 | |
| 35 | for _, tc := range cases { |
| 36 | t.Setenvscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Setenv().("LANG", "") |
| 37 | t.Setenvscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Setenv().("LC_ALL", "") |
| 38 | t.Setenvscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Setenv().("LC_CTYPE", "") |
| 39 | for _, env := range []string{"LANG", "LC_ALL", "LC_CTYPE"} { |
| 40 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(tc.name+" "+env, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 41 | t.Setenvscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Setenv().(env, tc.locale) |
| 42 | if actual := getCharsetscip-go gomod github.com/gdamore/tcell/v3 . `github.com/gdamore/tcell/v3`/getCharset().(); actual != tc.charset { |
| 43 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("charset %q did not match %q", actual, tc.charset) |
| 44 | } |
| 45 | }) |
| 46 | } |
| 47 | } |
| 48 | } |