fixing tests

master
Jordan Orelli 10 years ago
parent 5fa482c1d0
commit 35b16e6e4f

@ -14,7 +14,7 @@ The following is taken to be the contents of a file named ex.moon:
# at the top level.
first_name: "jordan"
last_name: "orelli"
# lists of things should be supported
items: [
"one"
@ -22,20 +22,20 @@ The following is taken to be the contents of a file named ex.moon:
3.4
["five" 6 7.8]
]
# objects should be supported
hash: {key: "value" other_key: "other_value"}
other_hash: {
key_1: "one"
key_2: 2
key_3: 3.4
key_4: ["five" 6 7.8]
}
# we may reference an item that was defined earlier
repeat_hash: hash
# items can be hidden. i.e., they're only valid in the parse and eval stage as
# intermediate values internal to the config file; they are *not* visible to
# the host program. This is generally useful for composing larger, more
@ -114,7 +114,7 @@ file to be searched. Given the moon file ex.moon:
"jordan"
> moon get visible_item ex.moon
"it has a value"
"it has a value"
> moon get people ex.moon
[{hometown: "crooklyn" name: "the first name here" age: 28} {name: "the second name here" age: 30 hometown: "tha bronx"}]

@ -20,18 +20,14 @@ var valueTests = []struct {
{1, "1"},
{12345, "12345"},
{.1, "0.1"},
{1.0, "1.0"},
{1.0e9, "1000000000.0"},
// this is kinda gross, but it's the only way I've figured out how to
// prevent 1.0 printing out as 1 and thus having its type changed from
// float to int. Sometimes having obnoxious string representations is
// better than something having things change type.
{1.0, "1"}, // god dammit
{1.0e9, "1e+09"},
{"a string", `"a string"`},
{`it's got "quotes"`, `"it's got \"quotes\""`},
{person{"jordan", 28}, `{Name: "jordan" Age: 28}`},
{[]int{1, 2, 3}, `[1 2 3]`},
{[]float32{1.0, 2.2, 3.3}, `[1.0 2.2 3.3]`},
{[]float64{1.0, 2.2, 3.3}, `[1.0 2.2 3.3]`},
{[]float32{1.0, 2.2, 3.3}, `[1 2.2 3.3]`},
{[]float64{1.0, 2.2, 3.3}, `[1 2.2 3.3]`},
{[]string{"one", "two", "three"}, `["one" "two" "three"]`},
{
map[string]int{"one": 1, "two": 2, "three": 3},
@ -43,7 +39,7 @@ var valueTests = []struct {
"two": 2.0,
"pi": 3.14,
},
`{one: 1 two: 2.0 pi: 3.14}`,
`{one: 1 two: 2 pi: 3.14}`,
},
}

Loading…
Cancel
Save