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,31 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect '2≠1' do
|
5
|
+
1.to_lookout_expected.difference(2).message
|
6
|
+
end
|
7
|
+
|
8
|
+
expect '(cannot inspect actual result: error)≠nil' do
|
9
|
+
nil.to_lookout_expected.difference(stub(:inspect => proc{ raise 'error' })).message
|
10
|
+
end
|
11
|
+
|
12
|
+
expect 'nil≠(cannot inspect expected value: error)' do
|
13
|
+
Lookout::Expected::Object.new(stub(:inspect => proc{ raise 'error' })).difference(nil).message
|
14
|
+
end
|
15
|
+
|
16
|
+
expect '2≠1 (cannot generate more specific failure message: error)' do
|
17
|
+
Class.new(Lookout::Difference::Object){
|
18
|
+
def message
|
19
|
+
raise 'error'
|
20
|
+
end
|
21
|
+
}.new(2, 1).to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
expect '2≠1: (cannot diff expected value and actual result: error)' do
|
25
|
+
Class.new(Lookout::Difference::Object){
|
26
|
+
def diff
|
27
|
+
raise 'error'
|
28
|
+
end
|
29
|
+
}.new(2, 1).to_s
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect [] do
|
5
|
+
'a'.to_lookout_expected.difference(1).diff
|
6
|
+
end
|
7
|
+
|
8
|
+
expect '[-b-]{+a+}' do
|
9
|
+
'a'.to_lookout_expected.difference('b').diff.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
expect <<EOF.chomp do
|
13
|
+
@@ -1,2 +1,1 @@
|
14
|
+
-b
|
15
|
+
-c
|
16
|
+
+a
|
17
|
+
EOF
|
18
|
+
'a'.to_lookout_expected.difference("b\nc").diff.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
expect <<EOF.chomp do
|
22
|
+
@@ -1,1 +1,2 @@
|
23
|
+
-c
|
24
|
+
+a
|
25
|
+
+b
|
26
|
+
EOF
|
27
|
+
"a\nb".to_lookout_expected.difference("c").diff.to_s
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect 'a' do
|
5
|
+
Lookout::Encode.new('a').call
|
6
|
+
end
|
7
|
+
|
8
|
+
expect 'a' do
|
9
|
+
'%s' % Lookout::Encode.new('a')
|
10
|
+
end
|
11
|
+
|
12
|
+
expect 'a' do
|
13
|
+
[Lookout::Encode.new('a')].join('')
|
14
|
+
end
|
15
|
+
|
16
|
+
expect 'a' do
|
17
|
+
a = 'a'
|
18
|
+
class << a; undef encode end if a.respond_to? :encode
|
19
|
+
Lookout::Encode.new(a).call
|
20
|
+
end
|
21
|
+
|
22
|
+
if 'a'.respond_to? :encode
|
23
|
+
expect Encoding::UTF_8 do
|
24
|
+
a = 'a'.force_encoding('ASCII-8BIT')
|
25
|
+
Lookout::Encode.new(a).call.encoding
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect 'error' do
|
5
|
+
Lookout::Exception.new(RuntimeError.new('error')).message
|
6
|
+
end
|
7
|
+
|
8
|
+
if ''.respond_to? :encode
|
9
|
+
expect "cannot retrieve error message: error" do
|
10
|
+
Lookout::Exception.new(stub(:to_str => proc{ raise 'error' })).message
|
11
|
+
end
|
12
|
+
|
13
|
+
expect "cannot retrieve error message: can't convert Lookout::Stub to String (Lookout::Stub#to_s gives NilClass)" do
|
14
|
+
Lookout::Exception.new(stub(:to_str => nil, :to_s => nil)).message
|
15
|
+
end
|
16
|
+
|
17
|
+
expect 'cannot encode error message for output: "\xE2" from ASCII-8BIT to UTF-8; dumping instead: "can\xE2\x80\x99t"' do
|
18
|
+
Lookout::Exception.new(stub(:to_str => 'can’t'.force_encoding('ASCII-8BIT'))).message
|
19
|
+
end
|
20
|
+
|
21
|
+
expect 'cannot encode error message for output: "\xE2" from ASCII-8BIT to UTF-8' do
|
22
|
+
stub('can’t'.force_encoding('ASCII-8BIT'), :dump => proc{ raise 'error' }){ |message|
|
23
|
+
Lookout::Exception.new(stub(:to_str => message)).message
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
expect 'unhandled exception' do
|
29
|
+
stub(RuntimeError.new(''), :message => proc{ raise 'inner' }){ |exception|
|
30
|
+
Lookout::Exception.new(exception).header
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
expect 'unhandled exception' do
|
35
|
+
Lookout::Exception.new(RuntimeError.new('')).header
|
36
|
+
end
|
37
|
+
|
38
|
+
expect 'unhandled exception' do
|
39
|
+
Lookout::Exception.new(RuntimeError.new("\n")).header
|
40
|
+
end
|
41
|
+
|
42
|
+
expect 'StandardError' do
|
43
|
+
Lookout::Exception.new(StandardError.new('')).header
|
44
|
+
end
|
45
|
+
|
46
|
+
expect 'error' do
|
47
|
+
stub(Class.new(StandardError).new('error'), :class => stub(:name => nil)){ |exception|
|
48
|
+
Lookout::Exception.new(exception).header
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
expect 'error (cannot determine name of class of exception: inner)' do
|
53
|
+
stub(Class.new(StandardError).new('error'), :class => stub(:name => proc{ raise 'inner' })){ |exception|
|
54
|
+
Lookout::Exception.new(exception).header
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
expect 'error' do
|
59
|
+
Lookout::Exception.new(Class.new(StandardError).new('error')).header
|
60
|
+
end
|
61
|
+
|
62
|
+
expect 'error' do
|
63
|
+
Lookout::Exception.new(Class.new(StandardError).new("error\n")).header
|
64
|
+
end
|
65
|
+
|
66
|
+
expect 'error (StandardError)' do
|
67
|
+
Lookout::Exception.new(StandardError.new('error')).header
|
68
|
+
end
|
69
|
+
|
70
|
+
expect 'error (StandardError)' do
|
71
|
+
Lookout::Exception.new(StandardError.new("error\n")).header
|
72
|
+
end
|
73
|
+
|
74
|
+
expect "line 1 (StandardError)\nline 2\nline 3" do
|
75
|
+
Lookout::Exception.new(StandardError.new("line 1\nline 2\nline 3")).header
|
76
|
+
end
|
77
|
+
|
78
|
+
expect StandardError do
|
79
|
+
Lookout::Exception.new(StandardError.new).type
|
80
|
+
end
|
81
|
+
|
82
|
+
expect Lookout::Exception::Unknown do
|
83
|
+
stub(StandardError.new('error'), :class => proc{ raise 'inner' }){ |exception|
|
84
|
+
Lookout::Exception.new(exception).type
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
expect 'StandardError' do
|
89
|
+
Lookout::Exception.new(StandardError.new).type_name
|
90
|
+
end
|
91
|
+
|
92
|
+
expect 'cannot determine name of class of exception: inner' do
|
93
|
+
stub(StandardError.new('error'), :class => stub(:name => proc{ raise 'inner' })){ |exception|
|
94
|
+
Lookout::Exception.new(exception).type_name
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
expect 'cannot determine name of class of exception: cannot determine class of exception: inner' do
|
99
|
+
stub(StandardError.new('error'), :class => proc{ raise 'inner' }){ |exception|
|
100
|
+
Lookout::Exception.new(exception).type_name
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
expect "line 1 (StandardError)\nline 2\n\tfrom a:1\n\tfrom b:2" do
|
105
|
+
Lookout::Exception.new(StandardError.new("line 1\nline 2").tap{ |e| e.set_backtrace ['a:1', 'b:2'] }).format
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect '' do
|
5
|
+
Lookout::Exception::Backtrace.from(nil).to_s
|
6
|
+
end
|
7
|
+
|
8
|
+
expect '' do
|
9
|
+
Lookout::Exception::Backtrace.from(stub(:backtrace => nil)).to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
expect "\tfrom 1
|
13
|
+
\tfrom 2
|
14
|
+
\tfrom 3
|
15
|
+
\tfrom 4
|
16
|
+
\tfrom 5
|
17
|
+
\tfrom 6
|
18
|
+
\tfrom 7
|
19
|
+
\tfrom 8
|
20
|
+
\t ... 6 levels ...
|
21
|
+
\tfrom A
|
22
|
+
\tfrom B
|
23
|
+
\tfrom C
|
24
|
+
\tfrom D
|
25
|
+
\tfrom E" do
|
26
|
+
Lookout::Exception::Backtrace.
|
27
|
+
from(SystemStackError.new('error').tap{ |e|
|
28
|
+
e.set_backtrace %w[1 2 3 4 5 6 7 8 a b c d e f A B C D E]
|
29
|
+
}).to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
expect "\tfrom a:1" do
|
33
|
+
Lookout::Exception::Backtrace.new('a:1', false).to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
expect "\tfrom a:1\n\tfrom b:2" do
|
37
|
+
Lookout::Exception::Backtrace.new(%w'a:1 b:2', false).to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
expect "\tfrom (cannot retrieve backtrace entry: error)" do
|
41
|
+
stub('a:1', :encode => proc{ raise 'error' }){ |entry|
|
42
|
+
Lookout::Exception::Backtrace.new([entry], false).to_s
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
expect "\tfrom a:1\n\tfrom (cannot retrieve backtrace entry: error)\n\tfrom c:3" do
|
47
|
+
stub('b:2', :encode => proc{ raise 'error' }){ |entry|
|
48
|
+
Lookout::Exception::Backtrace.new(['a:1', entry, 'c:3'], false).to_s
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
expect "\tfrom (backtrace is not an Array of String: 1)" do
|
53
|
+
Lookout::Exception::Backtrace.new(1, false).to_s
|
54
|
+
end
|
55
|
+
|
56
|
+
expect "\tfrom a:1\n\tfrom b:2" do
|
57
|
+
Lookout::Exception::Backtrace.
|
58
|
+
new(['a:1',
|
59
|
+
'b:2',
|
60
|
+
File.join(Lookout::Exception::Backtrace::Root, 'c:3'),
|
61
|
+
'd:4'],
|
62
|
+
false,
|
63
|
+
true).to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
expect "\tfrom b:2\n\tfrom c:3\n\tfrom d:4" do
|
67
|
+
Lookout::Exception::Backtrace.
|
68
|
+
new([File.join(Lookout::Exception::Backtrace::Root, 'a:1'),
|
69
|
+
'b:2',
|
70
|
+
'c:3',
|
71
|
+
'd:4'],
|
72
|
+
false,
|
73
|
+
true).to_s
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect RuntimeError.new('cannot determine class of exception: inner') do
|
5
|
+
Lookout::Exception::Unknown.new(RuntimeError.new('inner')).name
|
6
|
+
end
|
7
|
+
|
8
|
+
expect RuntimeError.new('cannot determine class of exception: cannot retrieve error message: inner') do
|
9
|
+
stub(RuntimeError.new, :message => proc{ raise 'inner' }){ |exception|
|
10
|
+
Lookout::Exception::Unknown.new(exception).name
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
expect '(cannot determine class of exception: inner)' do
|
15
|
+
Lookout::Exception::Unknown.new(RuntimeError.new('inner')).inspect
|
16
|
+
end
|
17
|
+
|
18
|
+
expect '(cannot determine class of exception: cannot retrieve error message: inner)' do
|
19
|
+
stub(RuntimeError.new, :message => proc{ raise 'inner' }){ |exception|
|
20
|
+
Lookout::Exception::Unknown.new(exception).inspect
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Expect::Exception do
|
5
|
+
Lookout::Expect.expect(StandardError.new, 'test', 1)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect NoMethodError do
|
9
|
+
Lookout::Aphonic.new.to_lookout_expected
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Lookout::Expect::Object do
|
13
|
+
Lookout::Expect.expect(Lookout::Aphonic.new, 'test', 1)
|
14
|
+
end
|
15
|
+
end
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Expect::Classes::Exception do
|
5
|
+
SystemExit.to_lookout_expected.expect('test', 1){ exit }
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Results::Success.new('test', 1) do
|
9
|
+
begin
|
10
|
+
SystemExit.to_lookout_expected.expect('test', 1){ exit }.call
|
11
|
+
rescue SystemExit
|
12
|
+
raise 'SystemExit not caught'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
expect Lookout::Results::Success.new('test', 1) do
|
17
|
+
StandardError.to_lookout_expected.expect('test', 1){ raise 'error' }.call
|
18
|
+
end
|
19
|
+
|
20
|
+
expect Lookout::Results::Success.new('test', 1) do
|
21
|
+
RuntimeError.to_lookout_expected.expect('test', 1){ raise 'error' }.call
|
22
|
+
end
|
23
|
+
|
24
|
+
expect Lookout::Results::Error do
|
25
|
+
ArgumentError.to_lookout_expected.expect('test', 1){ raise 'error' }.call
|
26
|
+
end
|
27
|
+
|
28
|
+
expect Lookout::Results::Failure.new('test', 1, Lookout::Difference::Object.new(nil, RuntimeError)) do
|
29
|
+
RuntimeError.to_lookout_expected.expect('test', 1){ nil }.call
|
30
|
+
end
|
31
|
+
|
32
|
+
expect Lookout::Results::Error do
|
33
|
+
ArgumentError.to_lookout_expected.expect('test', 1){
|
34
|
+
raise Class.new(RuntimeError){
|
35
|
+
def class
|
36
|
+
raise 'no class for you'
|
37
|
+
end
|
38
|
+
}
|
39
|
+
}.call
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Expect::Exception do
|
5
|
+
RuntimeError.new('error').to_lookout_expected.expect('test', 1)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Results::Success.new('test', 1) do
|
9
|
+
RuntimeError.new('error').to_lookout_expected.expect('test', 1){ raise 'error' }.call
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Lookout::Results::Failure.
|
13
|
+
new('test',
|
14
|
+
1,
|
15
|
+
Lookout::Difference::Exception.new(RuntimeError.new('b'),
|
16
|
+
RuntimeError.new('a'))) do
|
17
|
+
RuntimeError.new('a').to_lookout_expected.expect('test', 1){ raise 'b' }.call
|
18
|
+
end
|
19
|
+
|
20
|
+
expect Lookout::Results::Error do
|
21
|
+
StandardError.new('a').to_lookout_expected.expect('test', 1){ raise 'b' }.call
|
22
|
+
end
|
23
|
+
|
24
|
+
expect 'RuntimeError≠StandardError' do
|
25
|
+
StandardError.new('a').to_lookout_expected.expect('test', 1){ raise 'b' }.call.message
|
26
|
+
end
|
27
|
+
|
28
|
+
expect Lookout::Results::Error do
|
29
|
+
RuntimeError.new.to_lookout_expected.expect('test', 1){
|
30
|
+
raise Class.new(RuntimeError){
|
31
|
+
def class
|
32
|
+
raise 'no class for you'
|
33
|
+
end
|
34
|
+
}
|
35
|
+
}.call
|
36
|
+
end
|
37
|
+
|
38
|
+
expect '(cannot determine class of exception: no class for you)≠RuntimeError' do
|
39
|
+
RuntimeError.new.to_lookout_expected.expect('test', 1){
|
40
|
+
raise Class.new(RuntimeError){
|
41
|
+
def class
|
42
|
+
raise 'no class for you'
|
43
|
+
end
|
44
|
+
}
|
45
|
+
}.call.message
|
46
|
+
end
|
47
|
+
|
48
|
+
expect Lookout::Results::Error do
|
49
|
+
Class.new(RuntimeError){
|
50
|
+
def class
|
51
|
+
raise 'no class for you'
|
52
|
+
end
|
53
|
+
}.new('a').to_lookout_expected.expect('test', 1){ raise 'b' }.call
|
54
|
+
end
|
55
|
+
|
56
|
+
expect 'RuntimeError≠Exception' do
|
57
|
+
Class.new(RuntimeError){
|
58
|
+
def class
|
59
|
+
raise 'no class for you'
|
60
|
+
end
|
61
|
+
}.new('a').to_lookout_expected.expect('test', 1){ raise 'b' }.call.message
|
62
|
+
end
|
63
|
+
end
|