mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
GP-7031: Updating test and fixing warning
This commit is contained in:
@@ -16,22 +16,13 @@
|
||||
// Export function information in various formats (JSON, CSV, DOT)
|
||||
//@category Functions
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSetView;
|
||||
import ghidra.program.model.block.CodeBlockIterator;
|
||||
import ghidra.program.model.block.SimpleBlockModel;
|
||||
@@ -173,8 +164,8 @@ public class ExportFunctionInfoScript extends GhidraScript {
|
||||
summary.addProperty("selection_applied", scope != null);
|
||||
root.add("summary", summary);
|
||||
|
||||
try (FileWriter writer = new FileWriter(outputFile)) {
|
||||
gson.toJson(root, writer);
|
||||
try (FileWriter w = new FileWriter(outputFile)) {
|
||||
gson.toJson(root, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.script;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -22,6 +23,8 @@ import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -77,6 +80,9 @@ public class ExportFunctionInfoScriptTest extends AbstractGhidraHeadedIntegratio
|
||||
|
||||
ScriptTaskListener listener = env.runScript(script);
|
||||
|
||||
JDialog dialog = waitForJDialog("Choose Export Format");
|
||||
pressButtonByText(dialog, "OK");
|
||||
|
||||
chooseFile(outputFile);
|
||||
|
||||
waitForScriptCompletion(listener, 20000);
|
||||
|
||||
Reference in New Issue
Block a user