61 Commits

Author SHA1 Message Date
Jack Nagel
27e3ab781c Clean up test classes 2014-04-06 15:55:25 -05:00
Jack Nagel
7da459874f Make bottle implementation more generic 2014-03-10 14:56:02 -05:00
Jack Nagel
6008187d5f Encode formula revision in installation prefix
In order to allow kegs built with the same version but differing formula
revisions to coexist, we must encode the revision as part of the keg's
name. This is necessary to actually perform an upgrade, as we cannot
upgrade a keg in-place, and temporarily moving it pending the result of
the upgrade is error-prone and potentially slow.

To accomplish this, we introduce a new Formula#pkg_version method that
concatenates the active_spec version with the formula revision. An
exception is made for a formula that has no revision: the tag is
omitted. This preserves compatibility with existing installations.
2014-03-05 20:12:51 -06:00
Jack Nagel
e3e14a0cdf Eliminate nil check on path parameter 2014-02-21 20:07:41 -05:00
Jack Nagel
41a9ba8259 Move Formula.class_s to Formulary 2014-02-21 00:46:03 -05:00
Jack Nagel
fb350bad0f Remove downloader from Formula 2014-02-21 00:41:07 -05:00
Jack Nagel
662560e40d Remove test with too much implementation knowledge 2014-02-21 00:41:07 -05:00
Mike McQuaid
d7c13f84b6 Update string references to mxcl/homebrew. 2013-12-14 18:18:35 +00:00
Jack Nagel
5c18054341 Simplify prefix test 2013-12-11 19:18:23 -06:00
Jack Nagel
291cdea687 Extract constants for checkums in tests 2013-12-09 15:57:50 -06:00
Mike McQuaid
d9d2443d5d Cleanup use of some global constants. 2013-10-30 13:20:48 -07:00
Mike McQuaid
0296ffa0ef test_formula: add Mavericks bottles. 2013-10-23 22:15:28 +01:00
Mike McQuaid
0c332a23a2 test_formula: use different/consistent SHA-1. 2013-10-23 22:15:28 +01:00
Jack Nagel
63e1c71c50 Eagerly initialize formula specs
Declarations of dependencies, options, and resources in the DSL only
apply to specs that have already been initialized. For example, given
this snippet:

  url ...
  sha1 ...

  depends_on 'foo'

  devel do
    url ...
    sha1 ...
  end

The dependency 'foo' will be recorded for the stable spec, but not the
devel spec, since it was not initialized prior to the call to
depends_on.

While it is considered best practice to declare all specs (stable,
devel, head, and bottle) prior to other declarations, there is nothing
that enforces this ordering, so when it happens it can be confusing and
hard to debug.

To prevent this, we can initialize all specs up front. This comes with
a performance penalty for commands that load all formulae into memory,
but that is probably outweighed by what we gain in correctness.

Fixes Homebrew/homebrew#23425.
2013-10-22 13:31:08 -05:00
Jack Nagel
50c7c6bbd6 Check types in Formula#==
Comparing two objects should not raise an exception, even if they have
different types.

The semantics of #== are now the same as #eql?, so make one an alias.
2013-10-04 21:19:15 -05:00
Jack Nagel
5511a8b3f5 Move dependencies to SoftwareSpec 2013-09-21 19:27:24 -05:00
Jack Nagel
adceeb52f6 Stop exposing the download strategy from Formula 2013-09-13 22:33:46 -05:00
Jack Nagel
dd94518a40 Add test for option description rules 2013-08-31 20:40:06 -05:00
Jack Nagel
6ed24d3877 Add test for dependency options 2013-08-31 16:09:49 -05:00
Jack Nagel
8407ad2356 Add tests for Formula#installed_prefix 2013-05-25 17:19:19 -05:00
Jack Nagel
3a0726406b Add tests for FormulaPin and simplify implementation 2013-04-16 01:58:11 -05:00
Jack Nagel
e5eaa6696c Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation.
2013-04-13 18:23:06 -05:00
Jack Nagel
2e26afe556 Improved formula attribute validation
The initializer for Formula does a number of validations, but it does
them in a weird order, and some attributes aren't validated under
certain circumstances. This became even more of a mess when most
software package attributes were moved into the SoftwareSpec class.

This commit removes the last vestiges of storing these attributes as
instance variables. In particular, it eliminates #set_instance_variable
and #validate_variable, replacing them with methods that operate on
SoftwareSpec instances, and generate more useful errors.

Doing these validations unconditionally in the initializer means we bail
out much earlier if the formula has invalid attributes or is not fully
specified, and no longer need to validate in #prefix.

Technically we don't need to validate in #brew either, but we continue
to do so anyway as a safety measure, and because we cannot enforce calls
to super in subclasses.
2013-04-13 17:40:12 -05:00
Jack Nagel
909ac74644 Eliminate test_bucket
Most of the behavior tested here is now tested elsewhere. Move the
remaining useful tests to better places.
2013-04-10 22:27:56 -05:00
Jack Nagel
47282db255 Make test formulae initializers more flexible 2013-04-10 12:02:35 -05:00
Jack Nagel
eadb0f60a8 Move formula equality tests out of test_bucket 2013-04-10 12:02:35 -05:00
Jack Nagel
bd4aaac96b Check existence rather than rescue exceptions 2013-04-09 19:40:08 -05:00
Jack Nagel
63aace0e4e Clean up mirror support test 2013-04-08 19:15:22 -05:00
Jack Nagel
d07defa7c1 Fix specs in TestBall 2013-04-08 17:43:01 -05:00
Jack Nagel
ef0e4c259f Ensure ARGV is cleaned up 2013-04-08 00:27:47 -05:00
Jack Nagel
c816ad70b6 Simplify tests 2013-04-07 20:59:52 -05:00
Jack Nagel
c3d48b5d8a Don't use "assert_not_nil" 2013-04-02 15:33:34 -05:00
Jack Nagel
cfe922ffd4 Silence stderr in test suite 2013-04-01 12:15:29 -05:00
Jack Nagel
d994c6cdda Suppress ambiguous argument and grouped expression warnings 2013-03-28 17:37:29 -05:00
Jack Nagel
c8168d8a4a Simplify SoftwareSpec checksum methods
Reader methods for specific checksum types have been absent from the
Formula class for some time, so there isn't any reason to expose them in
SoftwareSpec, either.

Thus, these methods now only act as setters, and #checksum should be
used to access the constructed Checksum object.
2013-03-18 15:10:36 -05:00
Jack Nagel
303feacdd9 Fix tests under 32-bit SL 2013-03-09 17:38:45 -06:00
Jack Nagel
1a799f04e6 Remove unused variables 2013-02-18 12:13:35 -06:00
Jack Nagel
248891fde1 Avoid nil in URL specs 2013-02-11 20:52:07 -06:00
Mike McQuaid
9ba9e749b8 Remove MD5 support.
Closes Homebrew/homebrew#17317.
2013-01-30 22:36:12 -08:00
Mike McQuaid
b58077b3e8 Don't use underscores in (new) bottle filenames.
Closes Homebrew/homebrew#14270
2013-01-29 17:14:09 -08:00
Mike McQuaid
1107171f83 Cleanup old bottle syntax. 2013-01-29 17:14:00 -08:00
Jack Nagel
1027093eae tests: set newly-visible global constants
The changes to error ouput and logging require a few more things to be
visible during installation tests.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-29 12:14:57 -05:00
Jack Nagel
2ff6c40735 Add support for custom version schemes
A version scheme is a class that inherits from Version and reimplements
Version#<=>. This will allow formulae to specify a custom comparison
method that will be used instead of the default, for cases where the
default is insufficient.
2012-08-18 11:12:09 -05:00
Jack Nagel
e57122780e Add Version#detected_from_url? 2012-08-18 11:12:09 -05:00
Jack Nagel
329f0a8490 Replace version strings with Version objects 2012-08-18 11:12:08 -05:00
Jack Nagel
f5eaef0aee Deprecate ancient formula syntax
Closes Homebrew/homebrew#13444.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-09 23:56:54 -05:00
Jack Nagel
4ffc06f988 tests: expect that mirror lists are empty, not nil
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-05 20:33:28 -05:00
Jack Nagel
93f8c71e21 tests: clean up whitespace
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:34 -05:00
Jack Nagel
40b531deb1 Demonstrate that bottles are selected correctly
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:34 -05:00
Jack Nagel
90dbb8a141 Prune some requires from test files
testing_env already requires utils; set up the ARGV and ENV extensions
there as well.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:34 -05:00