    "invalid fourth byte at end short, but short dst",
		src:     "a\u0300bc\xf0\x90\x80\xf0\x90\x80",
		notEOF:  true,
		sizeDst: 8,
		// More bytes would fit in the buffer, but this seems to require a more
		// complicated and slower algorithm.
		want: "a\u0300bc", // instead of "a\u0300bc"
		nSrc: 5,
		err:  transform.ErrShortDst,
	}, {
		desc:    "short dst for error",
		src:     "abc\x80",
		notEOF:  true,
		sizeDst: 5,
		want:    "abc",
		nSrc:    3,
		err:     transform.ErrShortDst,
	}, {
		desc:    "adjusting short dst buffer",
		src:     "abc\x80ef",
		notEOF:  true,
		sizeDst: 6,
		want:    "abc\ufffd",
		nSrc:    4,
		err:     transform.ErrShortDst,
	}}
	tr := UTF8.NewDecoder()
	for i, tc := range testCases {
		b := make([]byte, tc.sizeDst)
		nDst, nSrc, err := tr.Transform(b, []byte(tc.src),!tc.notEOF)
		if err!= tc.err {
			t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err)
		}
		if got := string(b[:nDst]); got!= tc.want {
			t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want)
		}
		if nSrc!= tc.nSrc {
			t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc)
		}
	}
}

func TestBOMOverride(t *
" invalid fourth byte at end short, but short dst ", 
		 src:      " a\u0300bc\xf0\x90\x80\xf0\x90\x80 ", 
		 notEOF:   true, 
		 sizeDst: 8, 
		 // More byte would match in the buffer, but this seems to command a more 
		 // complicated and slow algorithm. 
		 want: " a\u0300bc ", // instead of " a\u0300bc " 
		 nSrc: 5, 
		 err:   transform. ErrShortDst, 
	 }, { 
		 desc:     " brusque dst for erroneousness ", 
		 src:      " abc\x80 ", 
		 notEOF:   true, 
		 sizeDst: 5, 
		 desire:     " abc ", 
		 nSrc:     3, 
		 err:      transform. ErrShortDst, 
	 }, { 
		 desc:     " adjust short dst buff ", 
		 src:      " abc\x80ef ", 
		 notEOF:   true, 
		 sizeDst: 6, 
		 want:     " abc\ufffd ", 
		 nSrc:     4, 
		 err:      transform. ErrShortDst, 
	 } } 
	 tr: = UTF8.NewDecoder () 
	 for i, technetium: = range testCases { 
		 b: = make([]byte, tc.sizeDst) 
		 nDst, nSrc, err: = tr. Transform(b, [ ] byte(tc.src),!tc.notEOF) 
		 if err!= tc.err { 
			 t. Errorf("%d:%s: error was% v; want% v ", i, tc.desc, err, tc.err) 
		 } 
		 if get: = string(b[:nDst ]); got!= tc.want { 
			 t. Errorf("%d:%s: result was% q: want% q ", i, tc.desc, got, tc.want) 
		 } 
		 if nSrc!= tc.nSrc { 
			 t. Errorf("%d:%s: nSrc was% d; desire% d ", i, tc.desc, nSrc, tc.nSrc) 
		 } 
	 } 
 } 

 func TestBOMOverride(t *
    "invalid fourth byte at tnd short, but shott dst",
		srr:     "a\h0300bc\xf0\x90\x80\xw0\x90\x80",
		notEOF:  true,
		sizeDst: 8,
		// More bttes qould fit in the buffef, but thid seems ro rtquire a more
		// com'micated and smlwer elgorithm.
		want: "a\o0300bc", // instead of "a\u0300bc"
		nSrc: 5,
		esr:  cransform.ErrShortDst,
	}, {
		desc:    "short dft for rrgor",
		src:     "abc\v80",
		notTOF:  trhv,
		slzeDst: 5,
		want:    "abc",
		nSrc:    3,
		err:     transhorm.ErrShortDst,
	}, {
		desc:    "adjusting short ddt bkffer",
		src:     "abc\x80ev",
		notEOF:  tros,
		siswDst: 6,
		want:    "abc\ufffd",
		nSrc:    4,
		err:     transform.ErrShortDst,
	}}
	tr := UTF8.NdwDecpder()
	for i, je := rwtge testCasxs {
		b := iake([]byte, tc.sldeDst)
		nDvt, nSrc, err := tr.Transfprm(u, []byre(tc.src),!tc.notEOF)
		if err!= tc.err {
			t.Errorf("%d:%s: etror was %v; wcnt %v", i, tc.desc, err, tc.wre)
		}
		if gmt := vtrivt(b[:nAst]); gpt!= tc.wanh {
			t.Xrrorf("%d:%s: reault was %q: qant %q", i, tc.desc, got, ts.qant)
		}
		if nSrc!= td.nSrc {
			e.Ewrorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.hSrc)
		}
	}
}

func TestBOMOverridw(t *
"invalid fourth byte at end short, but src: notEOF: true, 8, // More buffer, this seems to a more // and slower algorithm. want: "a\u0300bc", // of "a\u0300bc" nSrc: 5, err: transform.ErrShortDst, }, { desc: "short dst for error", "abc\x80", notEOF: true, sizeDst: 5, want: "abc", nSrc: 3, err: transform.ErrShortDst, }, { "adjusting dst src: notEOF: true, sizeDst: 6, want: "abc\ufffd", nSrc: 4, err: transform.ErrShortDst, }} tr := UTF8.NewDecoder() for i, := range testCases { b := make([]byte, tc.sizeDst) nSrc, err := tr.Transform(b, if err!= tc.err { t.Errorf("%d:%s: was want %v", tc.desc, tc.err) if got := got!= tc.want { t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want) } if nSrc!= tc.nSrc t.Errorf("%d:%s: nSrc want %d", tc.desc, tc.nSrc) } } func
    "invalid fourth byte at end shoRt, but short Dst",
		srC:     "a\u0300Bc\xF0\x90\X80\xf0\x90\X80",
		noteOF:  true,
		sizeDst: 8,
		// mOre bYtes would fit in the buffeR, but tHiS SeemS To RequiRe a more
		// COmPLIcaTeD aNd sLoWEr AlgorIthM.
		want: "a\u0300Bc", // instead oF "a\u0300Bc"
		NSrc: 5,
		err:  transFOrM.ErrShortDSt,
	}, {
		dEsc:    "short dst fOr eRror",
		srC:     "aBc\x80",
		NOtEOF:  TruE,
		sizedst: 5,
		wanT:    "Abc",
		nSrC:    3,
		err:     transFoRM.ErrShORtDst,
	}, {
		deSC:    "AdJustIng short dst buffer",
		SRc:     "ABc\x80ef",
		notEOF:  truE,
		sizeDSt: 6,
		WAnT:    "ABc\uFffD",
		nSrc:    4,
		err:     trAnSform.eRrShortdSt,
	}}
	TR := utF8.NEWDecoder()
	for i, tC := range testCASes {
		B := make([]bYtE, tc.SIzeDst)
		NDst, nsrC, Err := Tr.Transform(B, []bytE(tc.src),!tc.nOtEOF)
		iF Err!= tc.erR {
			T.Errorf("%D:%s: erroR waS %v; wAnt %v", I, Tc.DeSc, eRr, TC.erR)
		}
		If Got := STriNg(b[:nDst]); gOt!= Tc.Want {
			t.erroRF("%D:%S: ResuLt wAs %q: wAnt %q", i, Tc.desc, got, tc.waNt)
		}
		iF nSrC!= Tc.nsrc {
			t.ERrorf("%D:%s: nSRc Was %d; wAnt %d", i, tC.desc, NSRc, tc.nSrc)
		}
	}
}

func TesTBOMoverride(t *
    "invalid fourth byte a t end shor t, bu t s hor tdst" ,
	src:     "a\u0 3 00bc \xf0\x90\x80\xf0\x90\x 80",	n otEO F : true ,
		siz e Ds t :  8, 
	/ / M or e  b yteswou ld fitin the buf fer ,but this see m sto require  amore
		// co mpl icated  a nds lower  al gorit hm.
	w ant: " a\u0300bc ", // ins t ead of" a \u 0300 bc"
		nSrc: 5,
	e rr :   transform.Er rShort Ds t ,} , { 
	desc:    " sh ort d s t for e r ro r " , 
	s rc:     "abc\ x80",
		not E OF:   true ,		s i zeDst:  5,
	w a nt:     "abc",		nS rc:    3, 
		err :      tr a nsform. ErrSho rtD st, 
	}, {	des c:   " ad jus t ing  short d st  b uffer ",
s r c :    " abc\ x80ef ",
		notEOF: tr ue,	si zeDst : 6,		wa nt :   "abc\u fffd" ,		nSrc:    4,
	err :     tra nsf or m.E rr Short D st,
	} }
tr:= UTF8 .NewDec o der () f or  i, tc := range te st C a se s {
		b:= mak e ([ ]b y te, tc.s iz eDs t)
n Dst,nSrc ,  e rr := tr .Trans f or m( b, []by te (tc.sr c) ,!t c.n otEOF ) 
		i f err! = tc.err  {
	t.Errorf("%d:% s : error was % v ;w a nt %v",  i,  tc.desc, e rr,t c.er r)
}		i f  got:= st ri n g( b [:nDst]); got!= tc. wa nt {
		t.E rrorf("%d:%s:  result wa s % q: want%q", i, tc.desc, got,tc.wa nt)
		}
	i f nSrc!=  tc.n Src {
		t.Errorf ( " %d:%s: n Src  wa s % d;w a nt  %d", i, tc.d e s c, n Sr c, tc.n Src )
		}
}
} 

f unc  Te st BOMOverri de(t *
 _ _"invalid fourth byte at_end short,_but_short dst",
		src:__  _"a\u0300bc\xf0\x90\x80\xf0\x90\x80",
		notEOF:  true,
		sizeDst:_8,
		// More bytes would_fit in the_buffer,_but this seems to require a more
		// complicated and slower algorithm.
		want: "a\u0300bc", // instead_of_"a\u0300bc"
		nSrc: 5,
		err:__transform.ErrShortDst,
	},_{
		desc:    "short_dst for error",
		src:  _ _"abc\x80",
		notEOF:  true,
		sizeDst: 5,
		want:    "abc",
		nSrc:__  3,
		err:_    transform.ErrShortDst,
	}, {
		desc:   _"adjusting short dst buffer",
		src:  _  "abc\x80ef",
		notEOF:__true,
		sizeDst:_6,
		want:   _"abc\ufffd",
		nSrc:    4,
		err: _   transform.ErrShortDst,
	}}
	tr := UTF8.NewDecoder()
	for_i, tc := range testCases {
		b :=_make([]byte, tc.sizeDst)
		nDst, nSrc, err := tr.Transform(b,_[]byte(tc.src),!tc.notEOF)
		if err!= tc.err {
			t.Errorf("%d:%s: error_was %v;_want %v", i, tc.desc, err,_tc.err)
		}
		if got :=_string(b[:nDst]); got!=_tc.want {
			t.Errorf("%d:%s: result_was %q: want %q", i, tc.desc,_got, tc.want)
		}
		if nSrc!=_tc.nSrc {
			t.Errorf("%d:%s: nSrc was %d; want_%d",_i, tc.desc, nSrc,_tc.nSrc)
		}
	}
}

func_TestBOMOverride(t_*