Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(24)

Side by Side Diff: golxc_test.go

Issue 6853075: golxc: added configuration reading (Closed)
Patch Set: golxc: added configuration reading Created 11 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « config.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 package golxc_test
2
3 import (
4 . "launchpad.net/gocheck"
5 "launchpad.net/golxc"
6 "strings"
7 "testing"
8 )
9
10 func Test(t *testing.T) { TestingT(t) }
11
12 type ConfigurationSuite struct{}
13
14 var _ = Suite(&ConfigurationSuite{})
15
16 var cfgs = `# Leading commment.
17 VALUE1 = 12345
18 VALUE2="foo"
19 VALUE3 = "foo # bar"
20 VALUE4 = "foo = bar"
21 VALUE5 = "bar" # Trailing comment.
22 VALUE6 = bar # foo
23
24 # Comment inbetween.
25
26 VALUE7 =
27 VALUE8 = ""`
28
29 func (s *ConfigurationSuite) TestReadConfiguration(c *C) {
30 cr := strings.NewReader(cfgs)
31 cfg, err := golxc.ReadConfiguration(cr)
32 c.Assert(err, IsNil)
33 c.Assert(len(cfg), Equals, 8)
34 c.Assert(cfg["VALUE1"], Equals, "12345")
35 c.Assert(cfg["VALUE2"], Equals, "foo")
36 c.Assert(cfg["VALUE3"], Equals, "foo # bar")
37 c.Assert(cfg["VALUE4"], Equals, "foo = bar")
38 c.Assert(cfg["VALUE5"], Equals, "bar")
39 c.Assert(cfg["VALUE6"], Equals, "bar")
40 c.Assert(cfg["VALUE7"], Equals, "")
41 c.Assert(cfg["VALUE8"], Equals, "")
42 }
43
44 func (s *ConfigurationSuite) TestReadDefaultEnvironment(c *C) {
45 env, err := golxc.ReadDefaultEnvironment()
46 c.Assert(err, IsNil)
47 c.Assert(env["LXC_BRIDGE"], Equals, "lxcbr0")
fwereade 2012/11/21 17:37:11 Not sure about this -- is it possible to swap out
48 }
OLDNEW
« no previous file with comments | « config.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b