2017-07-05 23:10:57 +00:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions defined in
|
|
|
|
* file 'LICENSE.md', which is part of this source code package.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package textencoding
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestWinAnsiEncoder(t *testing.T) {
|
2019-01-01 21:17:57 +02:00
|
|
|
enc := NewWinAnsiEncoder()
|
2017-07-05 23:10:57 +00:00
|
|
|
|
2017-07-10 15:17:46 +00:00
|
|
|
glyph, found := enc.CharcodeToGlyph(32)
|
2017-07-05 23:10:57 +00:00
|
|
|
if !found || glyph != "space" {
|
|
|
|
t.Errorf("Glyph != space")
|
|
|
|
return
|
|
|
|
}
|
2018-12-29 19:01:05 +02:00
|
|
|
code, found := enc.RuneToCharcode('þ')
|
|
|
|
if !found || code != 254 {
|
|
|
|
t.Errorf("code != 254")
|
|
|
|
return
|
|
|
|
}
|
2017-07-05 23:10:57 +00:00
|
|
|
|
2017-07-10 15:17:46 +00:00
|
|
|
glyph, found = enc.RuneToGlyph('þ')
|
2017-07-05 23:10:57 +00:00
|
|
|
if !found || glyph != "thorn" {
|
|
|
|
t.Errorf("Glyph != thorn")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|