@Test
	public void testDeleteFunction() {

		// create a function at an address that has a valid code unit
		Address address = addr(0x0);

		// get a function from the program with a default name        
		String defaultName = SymbolUtilities.getDefaultFunctionName(address);

		int transactionID = program.startTransaction("TEST");

		Function function =
			createFunction(defaultName, address, new AddressSet(address, address.add(200L)));

		assertNotNull("The test function was not created as expected.", function);

		// create and call the delete the command to remove the function
		DeleteFunctionCmd deleteFunctionCmd = new DeleteFunctionCmd(address);
		deleteFunctionCmd.applyTo(program);

		// ensure the function is deleted
		function = program.getListing().getFunctionAt(address);
		assertNull("The function was not deleted as expected.", function);

		// make sure that there is no label where that function existed
		Symbol[] symbols = program.getSymbolTable().getSymbols(address);
		assertTrue(
			"The symbol where the function was removed has the " +
				"default name of the function when it should not.",
			!containsMatchingSymbolName(symbols, defaultName));

		//
		// repeat above steps for another function that has a user-defined name
		// 
		String customName = "CustomFunctionName";
		function = createFunction(customName, address, new AddressSet(address, address.add(200L)));

		assertNotNull("The test function was not created as expected.", function);

		// create and call the delete the command to remove the function
		deleteFunctionCmd = new DeleteFunctionCmd(address);
		deleteFunctionCmd.applyTo(program);

		// make sure that after the function is deleted that there is a symbol
		// at that address with the same name as the function
		function = program.getListing().getFunctionAt(address);
		assertNull("The function was not deleted as expected.", function);

		symbols = program.getSymbolTable().getSymbols(address);
		assertTrue(
			"A label with the same name as the function was not " +
				"created when that function was deleted.",
			containsMatchingSymbolName(symbols, customName));

		program.endTransaction(transactionID, false);
	}
Tests the deleting of functions via the {@link DeleteFunctionCmd}.
Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/DeleteFunctionCmdTest.java