lookout 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +351 -181
- data/Rakefile +20 -5
- data/lib/lookout-3.0.rb +138 -0
- data/lib/lookout-3.0/actual.rb +30 -0
- data/lib/lookout-3.0/actual/method.rb +31 -0
- data/lib/lookout-3.0/actual/not.rb +13 -0
- data/lib/lookout-3.0/actual/not/method.rb +10 -0
- data/lib/lookout-3.0/aphonic.rb +44 -0
- data/lib/lookout-3.0/diff.rb +29 -0
- data/lib/{lookout → lookout-3.0}/diff/algorithms.rb +1 -1
- data/lib/lookout-3.0/diff/algorithms/difflib.rb +62 -0
- data/lib/lookout-3.0/diff/algorithms/difflib/position.rb +63 -0
- data/lib/{lookout/diff/algorithms/difflib/position/to.rb → lookout-3.0/diff/algorithms/difflib/position/new.rb} +8 -17
- data/lib/lookout-3.0/diff/formats.rb +5 -0
- data/lib/lookout-3.0/diff/formats/inline.rb +43 -0
- data/lib/lookout-3.0/diff/formats/set.rb +48 -0
- data/lib/lookout-3.0/diff/formats/unified.rb +56 -0
- data/lib/lookout-3.0/diff/group.rb +57 -0
- data/lib/lookout-3.0/diff/groups.rb +47 -0
- data/lib/lookout-3.0/diff/match.rb +31 -0
- data/lib/lookout-3.0/diff/operation.rb +41 -0
- data/lib/lookout-3.0/diff/operations.rb +35 -0
- data/lib/lookout-3.0/diff/operations/copy.rb +25 -0
- data/lib/lookout-3.0/diff/operations/delete.rb +5 -0
- data/lib/lookout-3.0/diff/operations/insert.rb +5 -0
- data/lib/lookout-3.0/diff/operations/replace.rb +6 -0
- data/lib/lookout-3.0/diff/slice.rb +97 -0
- data/lib/lookout-3.0/difference.rb +10 -0
- data/lib/lookout-3.0/difference/array.rb +22 -0
- data/lib/lookout-3.0/difference/exception.rb +40 -0
- data/lib/lookout-3.0/difference/hash.rb +31 -0
- data/lib/lookout-3.0/difference/lookout.rb +5 -0
- data/lib/lookout-3.0/difference/lookout/actual.rb +6 -0
- data/lib/lookout-3.0/difference/lookout/actual/method.rb +13 -0
- data/lib/lookout-3.0/difference/lookout/actual/not.rb +6 -0
- data/lib/lookout-3.0/difference/lookout/actual/not/method.rb +9 -0
- data/lib/lookout-3.0/difference/lookout/output.rb +8 -0
- data/lib/lookout-3.0/difference/lookout/reception.rb +21 -0
- data/lib/lookout-3.0/difference/lookout/warning.rb +9 -0
- data/lib/lookout-3.0/difference/module.rb +12 -0
- data/lib/lookout-3.0/difference/object.rb +73 -0
- data/lib/lookout-3.0/difference/range.rb +12 -0
- data/lib/lookout-3.0/difference/regexp.rb +12 -0
- data/lib/lookout-3.0/difference/string.rb +21 -0
- data/lib/lookout-3.0/difference/symbol.rb +21 -0
- data/lib/lookout-3.0/encode.rb +20 -0
- data/lib/lookout-3.0/exception.rb +79 -0
- data/lib/lookout-3.0/exception/backtrace.rb +65 -0
- data/lib/lookout-3.0/exception/unknown.rb +25 -0
- data/lib/lookout-3.0/expect.rb +32 -0
- data/lib/lookout-3.0/expect/classes.rb +6 -0
- data/lib/lookout-3.0/expect/classes/exception.rb +27 -0
- data/lib/lookout-3.0/expect/exception.rb +30 -0
- data/lib/lookout-3.0/expect/object.rb +54 -0
- data/lib/lookout-3.0/expect/object/context.rb +149 -0
- data/lib/lookout-3.0/expectations.rb +69 -0
- data/lib/lookout-3.0/expectations/context.rb +52 -0
- data/lib/lookout-3.0/expected.rb +10 -0
- data/lib/lookout-3.0/expected/array.rb +16 -0
- data/lib/lookout-3.0/expected/classes.rb +5 -0
- data/lib/lookout-3.0/expected/classes/exception.rb +14 -0
- data/lib/lookout-3.0/expected/exception.rb +46 -0
- data/lib/lookout-3.0/expected/falseclass.rb +9 -0
- data/lib/lookout-3.0/expected/hash.rb +14 -0
- data/lib/lookout-3.0/expected/lookout.rb +5 -0
- data/lib/lookout-3.0/expected/lookout/actual.rb +5 -0
- data/lib/lookout-3.0/expected/lookout/actual/method.rb +13 -0
- data/lib/lookout-3.0/expected/lookout/actual/not.rb +6 -0
- data/lib/lookout-3.0/expected/lookout/actual/not/method.rb +13 -0
- data/lib/lookout-3.0/expected/lookout/output.rb +26 -0
- data/lib/lookout-3.0/expected/lookout/reception.rb +24 -0
- data/lib/lookout-3.0/expected/lookout/warning.rb +29 -0
- data/lib/lookout-3.0/expected/module.rb +12 -0
- data/lib/lookout-3.0/expected/object.rb +30 -0
- data/lib/lookout-3.0/expected/range.rb +12 -0
- data/lib/lookout-3.0/expected/regexp.rb +12 -0
- data/lib/lookout-3.0/expected/string.rb +11 -0
- data/lib/lookout-3.0/expected/symbol.rb +21 -0
- data/lib/lookout-3.0/expected/trueclass.rb +9 -0
- data/lib/lookout-3.0/inspect.rb +45 -0
- data/lib/lookout-3.0/interfaces.rb +5 -0
- data/lib/lookout-3.0/interfaces/commandline.rb +109 -0
- data/lib/lookout-3.0/literal.rb +18 -0
- data/lib/lookout-3.0/mock.rb +24 -0
- data/lib/lookout-3.0/object.rb +6 -0
- data/lib/lookout-3.0/object/not.rb +16 -0
- data/lib/lookout-3.0/object/not/receive.rb +18 -0
- data/lib/lookout-3.0/object/to.rb +12 -0
- data/lib/lookout-3.0/object/to/receive.rb +18 -0
- data/lib/lookout-3.0/output.rb +20 -0
- data/lib/lookout-3.0/plugins.rb +7 -0
- data/lib/lookout-3.0/reception.rb +128 -0
- data/lib/lookout-3.0/reception/arguments.rb +20 -0
- data/lib/lookout-3.0/reception/arguments/any.rb +16 -0
- data/lib/lookout-3.0/reception/arguments/error.rb +5 -0
- data/lib/lookout-3.0/reception/arguments/list.rb +17 -0
- data/lib/lookout-3.0/reception/arguments/none.rb +6 -0
- data/lib/lookout-3.0/reception/error.rb +24 -0
- data/lib/lookout-3.0/result.rb +16 -0
- data/lib/lookout-3.0/results.rb +5 -0
- data/lib/lookout-3.0/results/error.rb +18 -0
- data/lib/lookout-3.0/results/failure.rb +15 -0
- data/lib/lookout-3.0/results/success.rb +7 -0
- data/lib/lookout-3.0/stub.rb +55 -0
- data/lib/lookout-3.0/version.rb +133 -0
- data/lib/lookout-3.0/warning.rb +40 -0
- data/test/unit/examples.rb +208 -83
- data/test/unit/{lookout.rb → lookout-3.0.rb} +0 -0
- data/test/unit/lookout-3.0/actual.rb +13 -0
- data/test/unit/lookout-3.0/actual/method.rb +31 -0
- data/test/unit/lookout-3.0/actual/not.rb +15 -0
- data/test/unit/lookout-3.0/actual/not/method.rb +7 -0
- data/test/unit/lookout-3.0/aphonic.rb +31 -0
- data/test/unit/{lookout → lookout-3.0}/diff.rb +0 -0
- data/test/unit/{lookout/diff/group.rb → lookout-3.0/diff/algorithms.rb} +0 -0
- data/test/unit/lookout-3.0/diff/algorithms/difflib.rb +56 -0
- data/test/unit/lookout-3.0/diff/algorithms/difflib/position.rb +92 -0
- data/test/unit/{lookout/diff/algorithms/difflib/position/to.rb → lookout-3.0/diff/algorithms/difflib/position/new.rb} +1 -2
- data/test/unit/{lookout/results.rb → lookout-3.0/diff/formats.rb} +0 -0
- data/test/unit/{lookout → lookout-3.0}/diff/formats/inline.rb +0 -0
- data/test/unit/lookout-3.0/diff/formats/set.rb +26 -0
- data/test/unit/{lookout → lookout-3.0}/diff/formats/unified.rb +0 -0
- data/test/unit/{lookout/results/error.rb → lookout-3.0/diff/group.rb} +0 -0
- data/test/unit/lookout-3.0/diff/groups.rb +102 -0
- data/test/unit/{lookout → lookout-3.0}/diff/match.rb +0 -0
- data/test/unit/lookout-3.0/diff/operation.rb +17 -0
- data/test/unit/lookout-3.0/diff/operations.rb +22 -0
- data/test/unit/lookout-3.0/diff/operations/copy.rb +50 -0
- data/test/unit/lookout-3.0/diff/operations/delete.rb +45 -0
- data/test/unit/lookout-3.0/diff/operations/insert.rb +45 -0
- data/test/unit/lookout-3.0/diff/operations/replace.rb +45 -0
- data/test/unit/lookout-3.0/diff/slice.rb +56 -0
- data/test/unit/{lookout/results/failures/behavior.rb → lookout-3.0/difference.rb} +0 -0
- data/test/unit/lookout-3.0/difference/array.rb +32 -0
- data/test/unit/lookout-3.0/difference/exception.rb +69 -0
- data/test/unit/lookout-3.0/difference/hash.rb +30 -0
- data/test/unit/{lookout/results/failures/state.rb → lookout-3.0/difference/lookout.rb} +0 -0
- data/test/unit/{lookout/results/fulfilled.rb → lookout-3.0/difference/lookout/actual.rb} +0 -0
- data/test/unit/lookout-3.0/difference/lookout/actual/method.rb +7 -0
- data/test/unit/{lookout/runners/console.rb → lookout-3.0/difference/lookout/actual/not.rb} +0 -0
- data/test/unit/lookout-3.0/difference/lookout/actual/not/method.rb +7 -0
- data/test/unit/lookout-3.0/difference/lookout/output.rb +11 -0
- data/test/unit/lookout-3.0/difference/lookout/reception.rb +11 -0
- data/test/unit/lookout-3.0/difference/lookout/warning.rb +11 -0
- data/test/unit/lookout-3.0/difference/module.rb +11 -0
- data/test/unit/lookout-3.0/difference/object.rb +31 -0
- data/test/unit/lookout-3.0/difference/range.rb +11 -0
- data/test/unit/lookout-3.0/difference/regexp.rb +11 -0
- data/test/unit/lookout-3.0/difference/string.rb +29 -0
- data/test/unit/lookout-3.0/difference/symbol.rb +11 -0
- data/test/unit/lookout-3.0/encode.rb +28 -0
- data/test/unit/lookout-3.0/exception.rb +107 -0
- data/test/unit/lookout-3.0/exception/backtrace.rb +75 -0
- data/test/unit/lookout-3.0/exception/unknown.rb +23 -0
- data/test/unit/lookout-3.0/expect.rb +15 -0
- data/test/unit/{lookout/ui/console.rb → lookout-3.0/expect/classes.rb} +0 -0
- data/test/unit/lookout-3.0/expect/classes/exception.rb +41 -0
- data/test/unit/lookout-3.0/expect/exception.rb +63 -0
- data/test/unit/lookout-3.0/expect/object.rb +55 -0
- data/test/unit/lookout-3.0/expect/object/context.rb +120 -0
- data/test/unit/lookout-3.0/expectations.rb +55 -0
- data/test/unit/lookout-3.0/expectations/context.rb +44 -0
- data/test/unit/lookout-3.0/expected.rb +4 -0
- data/test/unit/lookout-3.0/expected/array.rb +19 -0
- data/test/unit/lookout-3.0/expected/classes.rb +4 -0
- data/test/unit/lookout-3.0/expected/classes/exception.rb +7 -0
- data/test/unit/lookout-3.0/expected/exception.rb +24 -0
- data/test/unit/lookout-3.0/expected/falseclass.rb +23 -0
- data/test/unit/lookout-3.0/expected/hash.rb +23 -0
- data/test/unit/lookout-3.0/expected/lookout.rb +4 -0
- data/test/unit/lookout-3.0/expected/lookout/actual.rb +4 -0
- data/test/unit/lookout-3.0/expected/lookout/actual/method.rb +11 -0
- data/test/unit/lookout-3.0/expected/lookout/actual/not.rb +4 -0
- data/test/unit/lookout-3.0/expected/lookout/actual/not/method.rb +11 -0
- data/test/unit/lookout-3.0/expected/lookout/output.rb +27 -0
- data/test/unit/lookout-3.0/expected/lookout/reception.rb +25 -0
- data/test/unit/lookout-3.0/expected/lookout/warning.rb +48 -0
- data/test/unit/lookout-3.0/expected/module.rb +23 -0
- data/test/unit/lookout-3.0/expected/object.rb +24 -0
- data/test/unit/lookout-3.0/expected/range.rb +19 -0
- data/test/unit/lookout-3.0/expected/regexp.rb +19 -0
- data/test/unit/lookout-3.0/expected/string.rb +44 -0
- data/test/unit/lookout-3.0/expected/symbol.rb +35 -0
- data/test/unit/lookout-3.0/expected/trueclass.rb +23 -0
- data/test/unit/lookout-3.0/inspect.rb +39 -0
- data/test/unit/lookout-3.0/interfaces.rb +4 -0
- data/test/unit/lookout-3.0/interfaces/commandline.rb +4 -0
- data/test/unit/lookout-3.0/literal.rb +15 -0
- data/test/unit/lookout-3.0/mock.rb +22 -0
- data/test/unit/lookout-3.0/object.rb +4 -0
- data/test/unit/lookout-3.0/object/not.rb +7 -0
- data/test/unit/lookout-3.0/object/not/receive.rb +9 -0
- data/test/unit/lookout-3.0/object/to.rb +7 -0
- data/test/unit/lookout-3.0/object/to/receive.rb +9 -0
- data/test/unit/lookout-3.0/output.rb +31 -0
- data/test/unit/lookout-3.0/plugins.rb +4 -0
- data/test/unit/lookout-3.0/reception.rb +86 -0
- data/test/unit/lookout-3.0/reception/arguments.rb +23 -0
- data/test/unit/lookout-3.0/reception/arguments/any.rb +15 -0
- data/test/unit/lookout-3.0/reception/arguments/error.rb +4 -0
- data/test/unit/lookout-3.0/reception/arguments/list.rb +19 -0
- data/test/unit/lookout-3.0/reception/arguments/none.rb +15 -0
- data/test/unit/lookout-3.0/reception/error.rb +4 -0
- data/test/unit/lookout-3.0/result.rb +27 -0
- data/test/unit/lookout-3.0/results.rb +4 -0
- data/test/unit/lookout-3.0/results/error.rb +37 -0
- data/test/unit/lookout-3.0/results/failure.rb +21 -0
- data/test/unit/lookout-3.0/results/success.rb +4 -0
- data/test/unit/lookout-3.0/stub.rb +53 -0
- data/test/unit/lookout-3.0/version.rb +4 -0
- data/test/unit/lookout-3.0/warning.rb +47 -0
- metadata +1159 -456
- data/lib/lookout.rb +0 -30
- data/lib/lookout/aphonic.rb +0 -40
- data/lib/lookout/diff.rb +0 -10
- data/lib/lookout/diff/algorithms/difflib.rb +0 -38
- data/lib/lookout/diff/algorithms/difflib/position.rb +0 -92
- data/lib/lookout/diff/formats.rb +0 -7
- data/lib/lookout/diff/formats/hash.rb +0 -53
- data/lib/lookout/diff/formats/inline.rb +0 -39
- data/lib/lookout/diff/formats/unified.rb +0 -57
- data/lib/lookout/diff/group.rb +0 -61
- data/lib/lookout/diff/groups.rb +0 -34
- data/lib/lookout/diff/match.rb +0 -36
- data/lib/lookout/diff/operation.rb +0 -33
- data/lib/lookout/diff/operations.rb +0 -36
- data/lib/lookout/diff/operations/delete.rb +0 -9
- data/lib/lookout/diff/operations/equal.rb +0 -27
- data/lib/lookout/diff/operations/insert.rb +0 -9
- data/lib/lookout/diff/operations/replace.rb +0 -9
- data/lib/lookout/diff/range.rb +0 -91
- data/lib/lookout/equalities.rb +0 -13
- data/lib/lookout/equalities/array.rb +0 -22
- data/lib/lookout/equalities/boolean.rb +0 -9
- data/lib/lookout/equalities/hash.rb +0 -25
- data/lib/lookout/equalities/include.rb +0 -9
- data/lib/lookout/equalities/object.rb +0 -24
- data/lib/lookout/equalities/output.rb +0 -19
- data/lib/lookout/equalities/standarderror.rb +0 -32
- data/lib/lookout/equalities/string.rb +0 -19
- data/lib/lookout/equalities/warning.rb +0 -16
- data/lib/lookout/equality.rb +0 -36
- data/lib/lookout/expectation.rb +0 -69
- data/lib/lookout/expectations.rb +0 -49
- data/lib/lookout/expectations/behavior.rb +0 -20
- data/lib/lookout/expectations/line.rb +0 -29
- data/lib/lookout/expectations/state.rb +0 -31
- data/lib/lookout/expectations/state/warning.rb +0 -26
- data/lib/lookout/mock.rb +0 -20
- data/lib/lookout/mock/method.rb +0 -70
- data/lib/lookout/mock/method/arguments.rb +0 -33
- data/lib/lookout/mock/method/arguments/any.rb +0 -11
- data/lib/lookout/mock/method/arguments/anything.rb +0 -11
- data/lib/lookout/mock/method/arguments/list.rb +0 -15
- data/lib/lookout/mock/method/arguments/none.rb +0 -11
- data/lib/lookout/mock/method/arguments/one.rb +0 -11
- data/lib/lookout/mock/method/calls.rb +0 -11
- data/lib/lookout/mock/method/calls/class.rb +0 -21
- data/lib/lookout/mock/method/calls/exactly.rb +0 -28
- data/lib/lookout/mock/method/calls/instance.rb +0 -25
- data/lib/lookout/mock/method/calls/lower.rb +0 -22
- data/lib/lookout/mock/method/calls/upper.rb +0 -22
- data/lib/lookout/mock/methods.rb +0 -12
- data/lib/lookout/mock/object.rb +0 -12
- data/lib/lookout/object.rb +0 -11
- data/lib/lookout/output.rb +0 -21
- data/lib/lookout/rake/tasks.rb +0 -36
- data/lib/lookout/rake/tasks/gem.rb +0 -49
- data/lib/lookout/rake/tasks/tags.rb +0 -16
- data/lib/lookout/rake/tasks/test.rb +0 -46
- data/lib/lookout/rake/tasks/test/loader.rb +0 -22
- data/lib/lookout/recorder.rb +0 -45
- data/lib/lookout/recorder/not.rb +0 -11
- data/lib/lookout/recorder/tape.rb +0 -21
- data/lib/lookout/recorders.rb +0 -6
- data/lib/lookout/recorders/reception.rb +0 -47
- data/lib/lookout/recorders/state.rb +0 -35
- data/lib/lookout/result.rb +0 -13
- data/lib/lookout/results.rb +0 -25
- data/lib/lookout/results/error.rb +0 -18
- data/lib/lookout/results/error/exception.rb +0 -34
- data/lib/lookout/results/error/exception/backtrace.rb +0 -50
- data/lib/lookout/results/failure.rb +0 -16
- data/lib/lookout/results/failures.rb +0 -6
- data/lib/lookout/results/failures/behavior.rb +0 -5
- data/lib/lookout/results/failures/state.rb +0 -5
- data/lib/lookout/results/fulfilled.rb +0 -5
- data/lib/lookout/results/unsuccessful.rb +0 -31
- data/lib/lookout/runners.rb +0 -6
- data/lib/lookout/runners/console.rb +0 -49
- data/lib/lookout/runners/trackers.rb +0 -5
- data/lib/lookout/runners/trackers/failure.rb +0 -14
- data/lib/lookout/stub.rb +0 -18
- data/lib/lookout/stub/method.rb +0 -105
- data/lib/lookout/stub/methods.rb +0 -18
- data/lib/lookout/stub/object.rb +0 -11
- data/lib/lookout/ui.rb +0 -7
- data/lib/lookout/ui/console.rb +0 -19
- data/lib/lookout/ui/silent.rb +0 -9
- data/lib/lookout/version.rb +0 -5
- data/lib/lookout/warning.rb +0 -7
- data/lib/lookout/xml.rb +0 -17
- data/test/unit/lookout/diff/algorithms/difflib.rb +0 -56
- data/test/unit/lookout/diff/algorithms/difflib/position.rb +0 -92
- data/test/unit/lookout/diff/groups.rb +0 -102
- data/test/unit/lookout/diff/operations.rb +0 -22
- data/test/unit/lookout/diff/operations/delete.rb +0 -45
- data/test/unit/lookout/diff/operations/equal.rb +0 -45
- data/test/unit/lookout/diff/operations/insert.rb +0 -45
- data/test/unit/lookout/diff/operations/replace.rb +0 -45
- data/test/unit/lookout/diff/range.rb +0 -50
- data/test/unit/lookout/equality.rb +0 -113
- data/test/unit/lookout/expectation.rb +0 -47
- data/test/unit/lookout/expectations.rb +0 -36
- data/test/unit/lookout/expectations/behavior.rb +0 -35
- data/test/unit/lookout/expectations/line.rb +0 -29
- data/test/unit/lookout/expectations/state.rb +0 -29
- data/test/unit/lookout/mock/method.rb +0 -143
- data/test/unit/lookout/mock/method/arguments.rb +0 -57
- data/test/unit/lookout/mock/method/arguments/any.rb +0 -11
- data/test/unit/lookout/recorder.rb +0 -11
- data/test/unit/lookout/results/error/exception/backtrace.rb +0 -20
- data/test/unit/lookout/results/unsuccessful.rb +0 -9
- data/test/unit/lookout/runners/trackers/failure.rb +0 -30
- data/test/unit/lookout/stub/method.rb +0 -48
- data/test/unit/lookout/stub/methods.rb +0 -19
- data/test/unit/lookout/xml.rb +0 -55
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Expect::Object do
|
5
|
+
2.to_lookout_expected.expect('test', 1)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Expect::Object do
|
9
|
+
stub.to_lookout_expected.expect('test', 1)
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Lookout::Results::Success.new('test', 1) do
|
13
|
+
2.to_lookout_expected.expect('test', 1){ 2 }.call
|
14
|
+
end
|
15
|
+
|
16
|
+
expect Lookout::Results::Failure.new('test', 1, Lookout::Difference::Object.new(3, 2)) do
|
17
|
+
2.to_lookout_expected.expect('test', 1){ 3 }.call
|
18
|
+
end
|
19
|
+
|
20
|
+
expect Lookout::Results::Error do
|
21
|
+
stub(:== => proc{ raise 'error' }).to_lookout_expected.expect('test', 1){ 2 }.call
|
22
|
+
end
|
23
|
+
|
24
|
+
expect 'error' do
|
25
|
+
stub(:== => proc{ raise 'error' }).to_lookout_expected.expect('test', 1){ 2 }.call.exception.message
|
26
|
+
end
|
27
|
+
|
28
|
+
expect Comparable do
|
29
|
+
2.to_lookout_expected.expect('test', 1)
|
30
|
+
end
|
31
|
+
|
32
|
+
expect nil do
|
33
|
+
2.to_lookout_expected.expect('test', 1) <=> 2
|
34
|
+
end
|
35
|
+
|
36
|
+
expect 0 do
|
37
|
+
2.to_lookout_expected.expect('test', 1) <=> 2.to_lookout_expected.expect('test', 1)
|
38
|
+
end
|
39
|
+
|
40
|
+
expect true do
|
41
|
+
(2.to_lookout_expected.expect('test', 1) <=> 2.to_lookout_expected.expect('test', 2)) < 0
|
42
|
+
end
|
43
|
+
|
44
|
+
expect false do
|
45
|
+
(2.to_lookout_expected.expect('test', 1) <=> 2.to_lookout_expected.expect('test', 0)) < 0
|
46
|
+
end
|
47
|
+
|
48
|
+
expect false do
|
49
|
+
(2.to_lookout_expected.expect('test', 1) <=> 2.to_lookout_expected.expect('test', 2)) > 0
|
50
|
+
end
|
51
|
+
|
52
|
+
expect true do
|
53
|
+
(2.to_lookout_expected.expect('test', 1) <=> 2.to_lookout_expected.expect('test', 0)) > 0
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Stub do
|
5
|
+
Lookout::Expect::Object::Context.new{ stub }.evaluate
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Object.new do |o|
|
9
|
+
Lookout::Expect::Object::Context.new{ stub(o, :a => 1){ |e| e } }.evaluate
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Object.new do |o|
|
13
|
+
Lookout::Expect::Object::Context.new{ stub(o, :a => 1){ |e| stub(e, :b => 2){ |f| f } } }.evaluate
|
14
|
+
end
|
15
|
+
|
16
|
+
expect 1 do
|
17
|
+
Lookout::Expect::Object::Context.new{ stub(Object.new, :a => 1){ |o| o.a } }.evaluate
|
18
|
+
end
|
19
|
+
|
20
|
+
expect false do
|
21
|
+
Lookout::Expect::Object::Context.new{ stub(o = Object.new, :nil? => true){ }; o.nil? }.evaluate
|
22
|
+
end
|
23
|
+
|
24
|
+
expect Lookout::Stub do
|
25
|
+
Lookout::Expect::Object::Context.new{ stub(:a => 1) }.evaluate
|
26
|
+
end
|
27
|
+
|
28
|
+
expect 1 do
|
29
|
+
Lookout::Expect::Object::Context.new{ stub(:a => 1).a }.evaluate
|
30
|
+
end
|
31
|
+
|
32
|
+
expect 1 do
|
33
|
+
Lookout::Expect::Object::Context.new{ stub(:a => proc{ 1 }).a }.evaluate
|
34
|
+
end
|
35
|
+
|
36
|
+
expect 1 do
|
37
|
+
Lookout::Expect::Object::Context.new{ stub(Object.new, :a => 1){ |o| o.a } }.evaluate
|
38
|
+
end
|
39
|
+
|
40
|
+
expect 'hello' do
|
41
|
+
with_global :$stdout, StringIO.new do
|
42
|
+
print 'hello'
|
43
|
+
$stdout.string
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
expect ArgumentError.new('no such global variable: $THIS_IS_NOT_THE_NAME_OF_A_GLOBAL') do
|
48
|
+
with_global :$THIS_IS_NOT_THE_NAME_OF_A_GLOBAL, StringIO.new do
|
49
|
+
print 'hello'
|
50
|
+
$stdout.string
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
expect true do
|
55
|
+
Lookout::Expect::Object::Context.new{ with_verbose{ $VERBOSE } }.evaluate
|
56
|
+
end
|
57
|
+
|
58
|
+
expect false do
|
59
|
+
Lookout::Expect::Object::Context.new{ with_verbose(false){ $VERBOSE } }.evaluate
|
60
|
+
end
|
61
|
+
|
62
|
+
expect true do
|
63
|
+
Lookout::Expect::Object::Context.new{
|
64
|
+
saved_verbose = $VERBOSE
|
65
|
+
with_verbose{ $VERBOSE }
|
66
|
+
$VERBOSE == saved_verbose
|
67
|
+
}.evaluate
|
68
|
+
end
|
69
|
+
|
70
|
+
expect true do
|
71
|
+
Lookout::Expect::Object::Context.new{
|
72
|
+
saved_verbose = $VERBOSE
|
73
|
+
with_verbose(false){ $VERBOSE }
|
74
|
+
$VERBOSE == saved_verbose
|
75
|
+
}.evaluate
|
76
|
+
end
|
77
|
+
|
78
|
+
expect 'hello' do
|
79
|
+
with_const 'Inventory::Rake::Tasks', 'hello' do
|
80
|
+
::Inventory::Rake::Tasks
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
expect 'hello' do
|
85
|
+
with_const '::Inventory::Rake::Tasks', 'hello' do
|
86
|
+
::Inventory::Rake::Tasks
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
expect NameError do
|
91
|
+
with_const '::', 'hello' do
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
expect NameError do
|
96
|
+
with_const '::::', 'hello' do
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
expect NameError do
|
101
|
+
with_const '::::::', 'hello' do
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
expect NameError do
|
106
|
+
with_const '::Inventory::Rake::Tasks::', 'hello' do
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
expect NameError do
|
111
|
+
with_const '::::Inventory::Rake::Tasks', 'hello' do
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
expect '123' do
|
116
|
+
with_env 'LINE' => '123' do
|
117
|
+
ENV['LINE']
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect [Lookout::Expect::Object] do
|
5
|
+
stub(Lookout::Expectations, :load => [proc{ expect 1 do 1 end }]){
|
6
|
+
Lookout::Expectations.new(nil).entries
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
expect [Lookout::Results::Error] do
|
11
|
+
begin
|
12
|
+
stub(Lookout::Expectations, :load => [proc{ expect 1 do exit end }]){
|
13
|
+
Lookout::Expectations.new(nil).map(&:call)
|
14
|
+
}
|
15
|
+
rescue SystemExit
|
16
|
+
raise 'SystemExit not caught'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
expect [Lookout::Results::Error] do
|
21
|
+
begin
|
22
|
+
stub(Lookout::Expectations, :load => [proc{ expect 1 do raise NoMemoryError end }]){
|
23
|
+
Lookout::Expectations.new(nil).map(&:call)
|
24
|
+
}
|
25
|
+
rescue NoMemoryError
|
26
|
+
raise 'NoMemoryError not caught'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
expect [Lookout::Results::Error] do
|
31
|
+
begin
|
32
|
+
stub(Lookout::Expectations, :load => [proc{ expect 1 do raise SignalException end }]){
|
33
|
+
Lookout::Expectations.new(nil).map(&:call)
|
34
|
+
}
|
35
|
+
rescue SignalException
|
36
|
+
raise 'SignalException not caught'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
expect [Lookout::Results::Error] do
|
41
|
+
begin
|
42
|
+
stub(Lookout::Expectations, :load => [proc{ expect 1 do raise Interrupt end }]){
|
43
|
+
Lookout::Expectations.new(nil).map(&:call)
|
44
|
+
}
|
45
|
+
rescue Interrupt
|
46
|
+
raise 'Interrupt not caught'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
expect [Lookout::Results::Error] do
|
51
|
+
stub(Lookout::Expectations, :load => [proc{ this_method_is_not_defined }]){
|
52
|
+
Lookout::Expectations.new(nil).map(&:call)
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect [Lookout::Results::Failure, Lookout::Results::Failure] do
|
5
|
+
[].tap{ |results|
|
6
|
+
Lookout::Expectations::Context.new{ |expect| results << expect.call }.instance_eval do
|
7
|
+
expect(1){ 2 }
|
8
|
+
expect(1){ 2 }
|
9
|
+
end
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
expect [Lookout::Results::Failure.new(__FILE__, __LINE__ + 3, Lookout::Difference::Object.new(2, 1))] do
|
14
|
+
[].tap{ |results|
|
15
|
+
Lookout::Expectations::Context.new{ |expect| results << expect.call }.instance_eval do
|
16
|
+
expect(1){ 2 }
|
17
|
+
end
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
expect [Lookout::Results::Success] do
|
22
|
+
[].tap{ |results|
|
23
|
+
Lookout::Expectations::Context.new{ |expect| results << expect.call }.instance_eval do
|
24
|
+
expect(/a/){ 'a' }
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
expect [Lookout::Results::Failure.new(__FILE__, __LINE__ + 3, Lookout::Difference::Object.new('a', /a/))] do
|
30
|
+
[].tap{ |results|
|
31
|
+
Lookout::Expectations::Context.new{ |expect| results << expect.call }.instance_eval do
|
32
|
+
expect(literal(/a/)){ 'a' }
|
33
|
+
end
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
expect [Lookout::Results::Success] do
|
38
|
+
[].tap{ |results|
|
39
|
+
Lookout::Expectations::Context.new{ |expect| results << expect.call }.instance_eval do
|
40
|
+
expect(literal(/a/)){ /a/ }
|
41
|
+
end
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Difference::Array do
|
5
|
+
%w[abc].to_lookout_expected.difference(nil)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Difference::Array do
|
9
|
+
%w[abc].to_lookout_expected.difference([])
|
10
|
+
end
|
11
|
+
|
12
|
+
expect nil do
|
13
|
+
%w[abc].to_lookout_expected.difference(%w[abc])
|
14
|
+
end
|
15
|
+
|
16
|
+
expect nil do
|
17
|
+
[Integer].to_lookout_expected.difference([1])
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Expect::Exception do
|
5
|
+
RuntimeError.new('a').to_lookout_expected.expect('test', 1)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect nil do
|
9
|
+
a = RuntimeError.new('a')
|
10
|
+
a.to_lookout_expected.difference(a)
|
11
|
+
end
|
12
|
+
|
13
|
+
expect nil do
|
14
|
+
RuntimeError.new('a').to_lookout_expected.difference(begin raise 'a'; rescue => e; e end)
|
15
|
+
end
|
16
|
+
|
17
|
+
expect Lookout::Difference::Exception do
|
18
|
+
RuntimeError.new('a').to_lookout_expected.difference(RuntimeError.new('b'))
|
19
|
+
end
|
20
|
+
|
21
|
+
expect Lookout::Difference::Exception do
|
22
|
+
RuntimeError.new('a').to_lookout_expected.difference(StandardError.new('a'))
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Difference::Object do
|
5
|
+
false.to_lookout_expected.difference(true)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect nil do
|
9
|
+
false.to_lookout_expected.difference(false)
|
10
|
+
end
|
11
|
+
|
12
|
+
expect nil do
|
13
|
+
false.to_lookout_expected.difference(nil)
|
14
|
+
end
|
15
|
+
|
16
|
+
expect Lookout::Difference::Object do
|
17
|
+
false.to_lookout_expected.difference(1)
|
18
|
+
end
|
19
|
+
|
20
|
+
expect Lookout::Difference::Object do
|
21
|
+
false.to_lookout_expected.difference(stub(:== => proc{ raise 'error' }))
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Difference::Hash do
|
5
|
+
{'a' => 1}.to_lookout_expected.difference('b')
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Difference::Hash do
|
9
|
+
{'a' => 1, 'b' => 2}.to_lookout_expected.difference({'a' => 1})
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Lookout::Difference::Hash do
|
13
|
+
{'a' => 1, 'b' => 2}.to_lookout_expected.difference({'a' => 1, 'b' => 3})
|
14
|
+
end
|
15
|
+
|
16
|
+
expect nil do
|
17
|
+
{'a' => 1, 'b' => 2}.to_lookout_expected.difference({'a' => 1, 'b' => 2})
|
18
|
+
end
|
19
|
+
|
20
|
+
expect nil do
|
21
|
+
{'a' => Integer, 'b' => 2}.to_lookout_expected.difference({'a' => 1, 'b' => 2})
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect nil do
|
5
|
+
Lookout::Actual.new.empty?.to_lookout_expected.difference([])
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Difference::Lookout::Actual::Method.new([1], Lookout::Actual::Method.new(:empty?)) do
|
9
|
+
Lookout::Actual.new.empty?.to_lookout_expected.difference([1])
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Difference::Lookout::Actual::Not::Method.new([], Lookout::Actual::Not::Method.new(:empty?)) do
|
5
|
+
Lookout::Actual.new.not.empty?.to_lookout_expected.difference([])
|
6
|
+
end
|
7
|
+
|
8
|
+
expect nil do
|
9
|
+
Lookout::Actual.new.not.empty?.to_lookout_expected.difference([1])
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Results::Success.new('test', 1) do
|
5
|
+
Lookout::Output.new('a').to_lookout_expected.expect('test', 1){ |io|
|
6
|
+
io.write('a')
|
7
|
+
}.call
|
8
|
+
end
|
9
|
+
|
10
|
+
expect Lookout::Results::Failure.
|
11
|
+
new('test',
|
12
|
+
1,
|
13
|
+
Lookout::Difference::Lookout::Output.new(Lookout::Output.new('b'),
|
14
|
+
Lookout::Output.new('a'))) do
|
15
|
+
Lookout::Output.new('a').to_lookout_expected.expect('test', 1){ |io|
|
16
|
+
io.write('b')
|
17
|
+
}.call
|
18
|
+
end
|
19
|
+
|
20
|
+
expect nil do
|
21
|
+
Lookout::Output.new('a').to_lookout_expected.difference(Lookout::Output.new('a'))
|
22
|
+
end
|
23
|
+
|
24
|
+
expect Lookout::Difference::Lookout::Output do
|
25
|
+
Lookout::Output.new('a').to_lookout_expected.difference(Lookout::Output.new('b'))
|
26
|
+
end
|
27
|
+
end
|