Commit Graph

126 Commits

Author SHA1 Message Date
Havoc Pennington
c3fe5509a7 test that ConfigParseOptions.setIncluder works. 2011-11-17 00:19:52 -05:00
Havoc Pennington
c5fc564c56 Fix Parseable.parse() to use passed-in options
This was causing at least a couple bugs; in one test, a properties file
was being parsed with conf syntax; and includes suddenly could not
be missing if the parent file could not be missing.
2011-11-16 23:47:55 -05:00
Havoc Pennington
0bb9d19727 test "10.0foo" path expression, and correct the spec
The spec described parsing this as a 1-element path but
the implementation parsed it as 2 elements which is probably
a better behavior because it's less surprising. The simple
rule is now "only quoted periods are special".
2011-11-16 23:23:46 -05:00
Havoc Pennington
9dc6f77078 Fix behavior when merging object,primitive,object.
The AbstractConfigObject.merge() method was wrong; it merged in the
wrong order, which produced incorrect results. But there was a test
verifying that the results were wrong! So it's OK right?
Anyway, fix the test, fix the code, be sure it's crystal clear in spec.
2011-11-16 22:07:14 -05:00
Havoc Pennington
e1329e54bf test the current behavior of duplicate keys set to object, then primitive, then object 2011-11-16 21:25:29 -05:00
Havoc Pennington
4676023f1c add the Play 1.2 "yabe" example application.conf as test05.conf 2011-11-16 21:11:06 -05:00
Havoc Pennington
e782f6c1ad fix line numbers in error messages. (start with 1.) 2011-11-16 21:04:59 -05:00
Havoc Pennington
e1628ee6de use newNumber when doing fromAnyRef on a Number with unknown subclass 2011-11-16 15:08:50 -05:00
Havoc Pennington
d1e12fdd36 move newNumber to ConfigNumber rather than AbstractConfigValue 2011-11-16 15:08:29 -05:00
Havoc Pennington
3610dc8d76 support "/" in unquoted strings (and therefore keys) 2011-11-16 11:03:16 -05:00
Havoc Pennington
20b75542e4 support "on" and "off" when converting string to boolean 2011-11-16 10:34:40 -05:00
Havoc Pennington
61b1281e90 Convert numbers to ConfigInt when possible, then ConfigLong, and ConfigDouble only when required
Had to overhaul and clean up equality of ConfigNumber as part of this.
2011-11-16 10:05:44 -05:00
Havoc Pennington
054e27ccd0 add comment about not having ConfigValue.parent() 2011-11-16 09:36:06 -05:00
Havoc Pennington
b7a73dc85b remove pluggable ConfigTransformer
Doesn't seem to have a useful purpose, was a bad idea.
Just hardcode the built-in automatic type conversions.
2011-11-16 09:33:18 -05:00
Havoc Pennington
ece196c146 mention foo.bar=10, foo.baz=12 style syntax (single line properties-style) 2011-11-15 23:35:24 -05:00
Havoc Pennington
ae10fadc04 two tests were identical, make them different again 2011-11-15 23:33:19 -05:00
Havoc Pennington
f81ab20caa implement ConfigObject.hasPath() 2011-11-15 23:30:03 -05:00
Havoc Pennington
f32c8bdd78 fix parsing of empty string path, and fix test suite which wasn't catching it 2011-11-15 23:28:08 -05:00
Havoc Pennington
e9fe426f7f fix unicodeTrim on all-whitespace strings 2011-11-15 23:26:43 -05:00
Havoc Pennington
41b9d5c68b Implement fromAnyRef and friends to wrap values in ConfigValue. 2011-11-15 22:46:53 -05:00
Havoc Pennington
3bdaaabf02 implement equals/hashCode/toString for SimpleConfigOrigin 2011-11-15 22:09:55 -05:00
Havoc Pennington
aefdb58e04 fix indentation, eclipse keeps screwing it up 2011-11-15 21:11:38 -05:00
Havoc Pennington
ed75c315bc add Config.empty variants that take origin description; use singleton for default-named empty object 2011-11-15 21:08:29 -05:00
Havoc Pennington
1841dd9c67 Add a real README, license, and rewrite spec. 2011-11-15 19:14:22 -05:00
Havoc Pennington
aae70ecb8e extensively fix fromProperties() and add tests
fromProperties() now parses paths with a strict "split on period"

It now handles more than one level of nested object.

It's now defined that if a properties file defines both an
object and a string at the same key, the object wins.
2011-11-15 19:13:12 -05:00
Havoc Pennington
d59786925d add a couple corner case tests related to include keyword 2011-11-15 16:37:47 -05:00
Havoc Pennington
68a22668bd change getMemorySize to getMemorySizeInBytes
Preserves the memory size vs. disk size distinction (powers of two vs. ten)
But specifies that it will be in bytes, for consistency with getMilliseconds
and clarity in general.
2011-11-15 16:37:06 -05:00
Havoc Pennington
598c5d045f support terabytes when parsing a memory size 2011-11-15 16:31:37 -05:00
Havoc Pennington
6ca952e516 Fix code to find includes relative to other includes. Support ParseOptions for load(). 2011-11-14 23:52:14 -05:00
Havoc Pennington
d257c3bbd9 attempt to rationalize the loader/includer code
Introduce ConfigIncluder pluggable includer interface.

Move all the parse-something logic from Config, Loader,
ConfigImpl, Parser into the Parseable abstraction.
2011-11-14 15:42:50 -05:00
Havoc Pennington
9b3efbd2d0 do a better job with origin when there's an empty config. add Config.empty(). 2011-11-14 10:26:53 -05:00
Havoc Pennington
54cd4ec3dd Overhaul the public API.
This patch is a little half-baked (it needs tests, and
there are a few bugs I know about). Fixes will be along.
2011-11-14 02:13:25 -05:00
Havoc Pennington
f1bedacdfc get rid of ConfigConfig, wasn't the right API.
Will replace it with something better later.
2011-11-12 22:59:43 -05:00
Havoc Pennington
31a8e9ee57 Save the original text of parsed numbers
Value concatenation is supposed to provide an illusion that
you can just type long unquoted sentences, but really they
are a series of tokens. Be sure we don't weirdly reformat
any numbers that happen to appear in unquoted text.
2011-11-12 22:42:25 -05:00
Havoc Pennington
52f34925dc Fix equality between ConfigObject of different types
By pulling equals/hashCode up into AbstractConfigObject
2011-11-12 22:19:24 -05:00
Havoc Pennington
6528ac5d1e check Map.get, Map.containsKey, Map.containsValue implementations with non-string parameter 2011-11-12 22:19:03 -05:00
Havoc Pennington
367b1b27fa remove a few unused methods 2011-11-12 22:07:55 -05:00
Havoc Pennington
e66eaddfc7 add a test for null in value concatenation 2011-11-12 21:53:40 -05:00
Havoc Pennington
7b0e5a1471 make whitespace handling Unicode-correct.
This is maybe a little above and beyond what will ever matter in practice.
2011-11-12 21:47:35 -05:00
Havoc Pennington
b0fdc6456c Relativize substitutions when including a file
This is needed because we resolve substitutions only
as the last step, and against the whole tree not
against each file.

Special handling is needed so that fallback to
system properties and environment variables still
works properly.
2011-11-12 19:23:09 -05:00
Havoc Pennington
b034ce8de3 remove unused import 2011-11-12 18:02:01 -05:00
Havoc Pennington
5327b5d5f5 add a couple of trivial benchmarks
Basically they just reveal there's nothing worth
performance tuning here.
2011-11-12 18:01:03 -05:00
Havoc Pennington
7a63eab4ab buffer the reader instead of the stream
seems to make more sense since the reader could be smarter about it?
2011-11-12 18:00:07 -05:00
Havoc Pennington
926a726ea3 fork jvm for test, run, and test:run 2011-11-12 17:45:12 -05:00
Havoc Pennington
a706c74396 move new BufferedInputStream inside try{} block
Not sure this makes any material difference.
2011-11-12 17:44:43 -05:00
Havoc Pennington
d5fba4b8a7 buffer the input stream for loading properties 2011-11-12 17:44:18 -05:00
Havoc Pennington
b1b2403a5d add akka-reference.conf as a test case 2011-11-12 17:08:08 -05:00
Havoc Pennington
0d4feca770 if we get UnsupportedEncodingException include it as cause in the ConfigException
"Least likely thing to matter, ever"
2011-11-12 16:52:50 -05:00
Havoc Pennington
466a096398 add properties-style.conf test
Showing .conf format with a properties-looking style
2011-11-12 16:43:38 -05:00
Havoc Pennington
75a1b12284 Allow omitting commas as long as there's a newline 2011-11-12 16:36:07 -05:00