1/* 2Copyright 2014 SAP SE 3 4Licensed under the Apache License, Version 2.0 (the "License"); 5you may not use this file except in compliance with the License. 6You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10Unless required by applicable law or agreed to in writing, software 11distributed under the License is distributed on an "AS IS" BASIS, 12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13See the License for the specific language governing permissions and 14limitations under the License. 15*/ 16 17package driver 18 19import ( 20 "testing" 21) 22 23type testIdentifier struct { 24 id Identifier 25 s string 26} 27 28var testIdentifierData = []*testIdentifier{ 29 &testIdentifier{"_", "_"}, 30 &testIdentifier{"_A", "_A"}, 31 &testIdentifier{"A#$_", "A#$_"}, 32 &testIdentifier{"1", `"1"`}, 33 &testIdentifier{"a", `"a"`}, 34 &testIdentifier{"$", `"$"`}, 35 &testIdentifier{"日本語", `"日本語"`}, 36 &testIdentifier{"testTransaction", `"testTransaction"`}, 37 &testIdentifier{"a.b.c", `"a.b.c"`}, 38 &testIdentifier{"AAA.BBB.CCC", `"AAA.BBB.CCC"`}, 39} 40 41func TestIdentifierStringer(t *testing.T) { 42 for i, d := range testIdentifierData { 43 if d.id.String() != d.s { 44 t.Fatalf("%d id %s - expected %s", i, d.id, d.s) 45 } 46 } 47} 48