File: app_id_test.go

package info (click to toggle)
golang-google-appengine 1.0.0-2~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 1,456 kB
  • sloc: sh: 22; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2011 Google Inc. All Rights Reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

package internal

import (
	"testing"
)

func TestAppIDParsing(t *testing.T) {
	testCases := []struct {
		in                           string
		partition, domain, displayID string
	}{
		{"simple-app-id", "", "", "simple-app-id"},
		{"domain.com:domain-app-id", "", "domain.com", "domain-app-id"},
		{"part~partition-app-id", "part", "", "partition-app-id"},
		{"part~domain.com:display", "part", "domain.com", "display"},
	}

	for _, tc := range testCases {
		part, dom, dis := parseFullAppID(tc.in)
		if part != tc.partition {
			t.Errorf("partition of %q: got %q, want %q", tc.in, part, tc.partition)
		}
		if dom != tc.domain {
			t.Errorf("domain of %q: got %q, want %q", tc.in, dom, tc.domain)
		}
		if dis != tc.displayID {
			t.Errorf("displayID of %q: got %q, want %q", tc.in, dis, tc.displayID)
		}
	}
}