Skip to content

Commit a3cff9b

Browse files
committed
Rename ExpectedPaymentResult -> TestResult
1 parent 319ad1b commit a3cff9b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

lightning-invoice/src/payment.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ mod tests {
13531353
.expect_send(Amount::ForInvoice(final_value_msat))
13541354
.expect_send(Amount::OnRetry(final_value_msat / 2));
13551355
let router = TestRouter {};
1356-
let scorer = RefCell::new(TestScorer::new().expect(ExpectedPaymentResult::PathFailure {
1356+
let scorer = RefCell::new(TestScorer::new().expect(TestResult::PaymentFailure {
13571357
path: path.clone(), short_channel_id: path[0].short_channel_id,
13581358
}));
13591359
let logger = TestLogger::new();
@@ -1389,8 +1389,8 @@ mod tests {
13891389
let payer = TestPayer::new().expect_send(Amount::ForInvoice(final_value_msat));
13901390
let router = TestRouter {};
13911391
let scorer = RefCell::new(TestScorer::new()
1392-
.expect(ExpectedPaymentResult::PathSuccess { path: route.paths[0].clone() })
1393-
.expect(ExpectedPaymentResult::PathSuccess { path: route.paths[1].clone() })
1392+
.expect(TestResult::PaymentSuccess { path: route.paths[0].clone() })
1393+
.expect(TestResult::PaymentSuccess { path: route.paths[1].clone() })
13941394
);
13951395
let logger = TestLogger::new();
13961396
let invoice_payer =
@@ -1487,13 +1487,13 @@ mod tests {
14871487
}
14881488

14891489
struct TestScorer {
1490-
expectations: Option<VecDeque<ExpectedPaymentResult>>,
1490+
expectations: Option<VecDeque<TestResult>>,
14911491
}
14921492

14931493
#[derive(Debug)]
1494-
enum ExpectedPaymentResult {
1495-
PathFailure { path: Vec<RouteHop>, short_channel_id: u64 },
1496-
PathSuccess { path: Vec<RouteHop> },
1494+
enum TestResult {
1495+
PaymentFailure { path: Vec<RouteHop>, short_channel_id: u64 },
1496+
PaymentSuccess { path: Vec<RouteHop> },
14971497
ProbeFailure { path: Vec<RouteHop>, short_channel_id: u64 },
14981498
ProbeSuccess { path: Vec<RouteHop> },
14991499
}
@@ -1505,7 +1505,7 @@ mod tests {
15051505
}
15061506
}
15071507

1508-
fn expect(mut self, expectation: ExpectedPaymentResult) -> Self {
1508+
fn expect(mut self, expectation: TestResult) -> Self {
15091509
self.expectations.get_or_insert_with(|| VecDeque::new()).push_back(expectation);
15101510
self
15111511
}
@@ -1524,17 +1524,17 @@ mod tests {
15241524
fn payment_path_failed(&mut self, actual_path: &[&RouteHop], actual_short_channel_id: u64) {
15251525
if let Some(expectations) = &mut self.expectations {
15261526
match expectations.pop_front() {
1527-
Some(ExpectedPaymentResult::PathFailure { path, short_channel_id }) => {
1527+
Some(TestResult::PaymentFailure { path, short_channel_id }) => {
15281528
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
15291529
assert_eq!(actual_short_channel_id, short_channel_id);
15301530
},
1531-
Some(ExpectedPaymentResult::PathSuccess { path }) => {
1531+
Some(TestResult::PaymentSuccess { path }) => {
15321532
panic!("Unexpected successful payment path: {:?}", path)
15331533
},
1534-
Some(ExpectedPaymentResult::ProbeFailure { path, .. }) => {
1534+
Some(TestResult::ProbeFailure { path, .. }) => {
15351535
panic!("Unexpected failed payment probe: {:?}", path)
15361536
},
1537-
Some(ExpectedPaymentResult::ProbeSuccess { path }) => {
1537+
Some(TestResult::ProbeSuccess { path }) => {
15381538
panic!("Unexpected successful payment probe: {:?}", path)
15391539
},
15401540
None => panic!("Unexpected payment_path_failed call: {:?}", actual_path),
@@ -1545,16 +1545,16 @@ mod tests {
15451545
fn payment_path_successful(&mut self, actual_path: &[&RouteHop]) {
15461546
if let Some(expectations) = &mut self.expectations {
15471547
match expectations.pop_front() {
1548-
Some(ExpectedPaymentResult::PathFailure { path, .. }) => {
1548+
Some(TestResult::PaymentFailure { path, .. }) => {
15491549
panic!("Unexpected payment path failure: {:?}", path)
15501550
},
1551-
Some(ExpectedPaymentResult::PathSuccess { path }) => {
1551+
Some(TestResult::PaymentSuccess { path }) => {
15521552
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
15531553
},
1554-
Some(ExpectedPaymentResult::ProbeFailure { path, .. }) => {
1554+
Some(TestResult::ProbeFailure { path, .. }) => {
15551555
panic!("Unexpected failed payment probe: {:?}", path)
15561556
},
1557-
Some(ExpectedPaymentResult::ProbeSuccess { path }) => {
1557+
Some(TestResult::ProbeSuccess { path }) => {
15581558
panic!("Unexpected successful payment probe: {:?}", path)
15591559
},
15601560
None => panic!("Unexpected payment_path_successful call: {:?}", actual_path),
@@ -1565,17 +1565,17 @@ mod tests {
15651565
fn probe_failed(&mut self, actual_path: &[&RouteHop], actual_short_channel_id: u64) {
15661566
if let Some(expectations) = &mut self.expectations {
15671567
match expectations.pop_front() {
1568-
Some(ExpectedPaymentResult::PathFailure { path, .. }) => {
1568+
Some(TestResult::PaymentFailure { path, .. }) => {
15691569
panic!("Unexpected failed payment path: {:?}", path)
15701570
},
1571-
Some(ExpectedPaymentResult::PathSuccess { path }) => {
1571+
Some(TestResult::PaymentSuccess { path }) => {
15721572
panic!("Unexpected successful payment path: {:?}", path)
15731573
},
1574-
Some(ExpectedPaymentResult::ProbeFailure { path, short_channel_id }) => {
1574+
Some(TestResult::ProbeFailure { path, short_channel_id }) => {
15751575
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
15761576
assert_eq!(actual_short_channel_id, short_channel_id);
15771577
},
1578-
Some(ExpectedPaymentResult::ProbeSuccess { path }) => {
1578+
Some(TestResult::ProbeSuccess { path }) => {
15791579
panic!("Unexpected successful payment probe: {:?}", path)
15801580
},
15811581
None => panic!("Unexpected payment_path_failed call: {:?}", actual_path),
@@ -1585,16 +1585,16 @@ mod tests {
15851585
fn probe_successful(&mut self, actual_path: &[&RouteHop]) {
15861586
if let Some(expectations) = &mut self.expectations {
15871587
match expectations.pop_front() {
1588-
Some(ExpectedPaymentResult::PathFailure { path, .. }) => {
1588+
Some(TestResult::PaymentFailure { path, .. }) => {
15891589
panic!("Unexpected payment path failure: {:?}", path)
15901590
},
1591-
Some(ExpectedPaymentResult::PathSuccess { path }) => {
1591+
Some(TestResult::PaymentSuccess { path }) => {
15921592
panic!("Unexpected successful payment path: {:?}", path)
15931593
},
1594-
Some(ExpectedPaymentResult::ProbeFailure { path, .. }) => {
1594+
Some(TestResult::ProbeFailure { path, .. }) => {
15951595
panic!("Unexpected failed payment probe: {:?}", path)
15961596
},
1597-
Some(ExpectedPaymentResult::ProbeSuccess { path }) => {
1597+
Some(TestResult::ProbeSuccess { path }) => {
15981598
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
15991599
},
16001600
None => panic!("Unexpected payment_path_successful call: {:?}", actual_path),

0 commit comments

Comments
 (0)