|
30 | 30 | import com.yegor256.Mktmp; |
31 | 31 | import com.yegor256.MktmpResolver; |
32 | 32 | import com.yegor256.Together; |
33 | | -import com.yegor256.farea.Farea; |
34 | 33 | import com.yegor256.tojos.MnCsv; |
35 | 34 | import com.yegor256.tojos.TjCached; |
36 | 35 | import com.yegor256.tojos.TjDefault; |
37 | 36 | import com.yegor256.tojos.Tojos; |
38 | 37 | import com.yegor256.xsline.Xsline; |
| 38 | +import fixtures.LargeXmir; |
39 | 39 | import java.io.IOException; |
40 | 40 | import java.nio.charset.StandardCharsets; |
41 | 41 | import java.nio.file.Files; |
42 | 42 | import java.nio.file.Path; |
43 | 43 | import java.nio.file.Paths; |
44 | 44 | import java.util.ArrayList; |
45 | 45 | import java.util.Collection; |
46 | | -import org.cactoos.bytes.BytesOf; |
47 | | -import org.cactoos.bytes.UncheckedBytes; |
48 | 46 | import org.cactoos.io.InputOf; |
49 | 47 | import org.cactoos.io.ResourceOf; |
50 | 48 | import org.cactoos.iterable.Sticky; |
51 | 49 | import org.cactoos.iterable.Synced; |
| 50 | +import org.cactoos.scalar.Unchecked; |
52 | 51 | import org.cactoos.set.SetOf; |
53 | 52 | import org.eolang.parser.EoSyntax; |
54 | 53 | import org.eolang.parser.TrParsing; |
@@ -242,66 +241,28 @@ void doesNotThrowIoException() { |
242 | 241 | @ExtendWith(MktmpResolver.class) |
243 | 242 | @ExtendWith(MayBeSlow.class) |
244 | 243 | @Timeout(600L) |
245 | | - void lintsLargeJnaClass(@Mktmp final Path home) throws Exception { |
| 244 | + void lintsLargeJnaClass() throws Exception { |
246 | 245 | final String path = "com/sun/jna/Pointer.class"; |
247 | | - final Path bin = Paths.get("target") |
248 | | - .resolve("jna-classes") |
249 | | - .resolve(path); |
250 | | - new Farea(home).together( |
251 | | - f -> { |
252 | | - f.clean(); |
253 | | - f.files() |
254 | | - .file(String.format("target/classes/%s", path)) |
255 | | - .write( |
256 | | - new UncheckedBytes( |
257 | | - new BytesOf( |
258 | | - new ResourceOf( |
259 | | - "com/sun/jna/Pointer.class" |
260 | | - ) |
261 | | - ) |
262 | | - ).asBytes() |
263 | | - ); |
264 | | - f.build() |
265 | | - .plugins() |
266 | | - .append("org.eolang", "jeo-maven-plugin", "0.7.2") |
267 | | - .execution("default") |
268 | | - .phase("process-classes") |
269 | | - .goals("disassemble"); |
270 | | - f.exec("process-classes"); |
271 | | - final Path pre = f.files().file( |
272 | | - "target/generated-sources/jeo-xmir/com/sun/jna/Pointer.xmir" |
273 | | - ).path(); |
274 | | - final XML xmir = new XMLDocument(pre); |
275 | | - final long start = System.currentTimeMillis(); |
276 | | - final Collection<Defect> defects = new ProgramTest.BcProgram(xmir).defects(); |
277 | | - final long msec = System.currentTimeMillis() - start; |
278 | | - final Path target = Paths.get("target"); |
279 | | - Files.write( |
280 | | - target.resolve("lint-summary.txt"), |
281 | | - String.join( |
282 | | - "\n", |
283 | | - String.format("Input: %s", path), |
284 | | - Logger.format( |
285 | | - "Size of .class: %[size]s (%1$s bytes)", |
286 | | - bin.toFile().length() |
287 | | - ), |
288 | | - Logger.format( |
289 | | - "Size of .xmir after disassemble: %[size]s (%1$s bytes, %d lines)", |
290 | | - pre.toFile().length(), |
291 | | - Files.readString(pre, StandardCharsets.UTF_8).split("\n").length |
292 | | - ), |
293 | | - Logger.format( |
294 | | - "Lint time: %[ms]s (%d ms)", |
295 | | - msec, msec |
296 | | - ) |
297 | | - ).getBytes(StandardCharsets.UTF_8) |
298 | | - ); |
299 | | - MatcherAssert.assertThat( |
300 | | - "Defects are empty, but they should not be", |
301 | | - defects, |
302 | | - Matchers.hasSize(Matchers.greaterThan(0)) |
303 | | - ); |
304 | | - } |
| 246 | + final XML xmir = new Unchecked<>(new LargeXmir()).value(); |
| 247 | + final long start = System.currentTimeMillis(); |
| 248 | + final Collection<Defect> defects = new ProgramTest.BcProgram(xmir).defects(); |
| 249 | + final long msec = System.currentTimeMillis() - start; |
| 250 | + final Path target = Paths.get("target"); |
| 251 | + Files.write( |
| 252 | + target.resolve("lint-summary.txt"), |
| 253 | + String.join( |
| 254 | + "\n", |
| 255 | + String.format("Input: %s", path), |
| 256 | + Logger.format( |
| 257 | + "Lint time: %[ms]s (%d ms)", |
| 258 | + msec, msec |
| 259 | + ) |
| 260 | + ).getBytes(StandardCharsets.UTF_8) |
| 261 | + ); |
| 262 | + MatcherAssert.assertThat( |
| 263 | + "Defects are empty, but they should not be", |
| 264 | + defects, |
| 265 | + Matchers.hasSize(Matchers.greaterThan(0)) |
305 | 266 | ); |
306 | 267 | } |
307 | 268 |
|
|
0 commit comments