mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
test(lsp): smoke-test everyday code intelligence per language with real servers (#1299)
* test(lsp): smoke-test everyday code intelligence per language with real servers A new ide-host integration test drives completion, go to definition, Find Usages, hover, diagnostics with a quick fix, an intention, formatting and rename on each language's fixtures/ project, through the ops the app's commands call and the language server the app starts by default: TypeScript (vtsls), Python (basedpyright + Ruff), Rust (rust-analyzer), Go (gopls), Java (jdtls) and Kotlin (kotlin-lsp). A failure names the language and the operation. The tests are ignored by default; a Language smoke workflow installs pinned server versions and runs one language per job on changes to crates/, languages/ and fixtures/. Adds fixtures/java-app (Maven, JDK 21) for Java. * test(lsp): rename TypeScript from a usage and check Rust errors while typing Covers the fixes the smoke test turned up: a TypeScript rename started at a call site in another file renames the declaration (#1301), and rust-analyzer's own diagnostics and fixes arrive without saving (#1306).
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.example.orders;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
OrderBook book = new OrderBook();
|
||||
book.place("alice", "Mechanical keyboard", 1, 8999);
|
||||
book.place("bob", "Wireless mouse", 2, 2999);
|
||||
book.place("alice", "USB-C hub", 1, 3999);
|
||||
|
||||
int unused = 42; // intentional warning: unused variable
|
||||
// Set a breakpoint here (QA: debugger) and inspect `book`.
|
||||
long revenue = book.revenueCents();
|
||||
System.out.printf("%d orders, revenue %.2f%n", book.size(), revenue / 100.0);
|
||||
book.largest().ifPresent(o -> System.out.println("Largest: " + o.product()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.example.orders;
|
||||
|
||||
/** A customer order: a product, how many and the unit price in cents. */
|
||||
public record Order(String customer, String product, int quantity, long unitPriceCents) {
|
||||
|
||||
public Order {
|
||||
if (quantity <= 0) throw new IllegalArgumentException("quantity must be positive");
|
||||
}
|
||||
|
||||
/** The order's total in cents. */
|
||||
public long totalCents() {
|
||||
return unitPriceCents * quantity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.example.orders;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/** Keeps the orders placed so far, in the order they were placed. */
|
||||
public class OrderBook {
|
||||
private final List<Order> orders = new ArrayList<>();
|
||||
|
||||
/** Places an order and returns it. */
|
||||
public Order place(String customer, String product, int quantity, long unitPriceCents) {
|
||||
Order order = new Order(customer, product, quantity, unitPriceCents);
|
||||
orders.add(order);
|
||||
return order;
|
||||
}
|
||||
|
||||
public List<Order> byCustomer(String customer) {
|
||||
return orders.stream().filter(o -> o.customer().equals(customer)).toList();
|
||||
}
|
||||
|
||||
public Optional<Order> largest() {
|
||||
return orders.stream().max(Comparator.comparingLong(Order::totalCents));
|
||||
}
|
||||
|
||||
// TODO: discounts for repeat customers
|
||||
public long revenueCents() {
|
||||
return orders.stream().mapToLong(Order::totalCents).sum();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return orders.size();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user