I can cite an example: in Dumas' “De Vicomte de Bragelonne”, Athos' son (the Vicomte) decides to go to war in Algeria, where he fights against the Arabs:
“The vicomte was summoned to surrender by the Arabs, but he made them a negative sign with his head, and continued to march towards the palisades. This was a mortal imprudence. Nevertheless the entire army was pleased that he would not retreat, since ill-chance had led him so near. He marched a few paces further, and the two regiments clapped their hands. It was at this moment the second discharge shook the walls, and the Vicomte de Bragelonne again disappeared in the smoke; but this time the smoke dispersed in vain; we no longer saw him standing. He was down, with his head lower than his legs, among the bushes, and the Arabs began to think of leaving their intrenchments to come and cut off his head or take his body-as is the custom with the infidels. But Monseigneur le Duc de Beaufort had followed all this with his eyes, and the sad spectacle drew from him many painful sighs. He then cried aloud, seeing the Arabs running like white phantoms among the mastic-trees, 'Grenadiers! lancers! will you let them take that noble body?'”
As far as I understand (it's hard because there are no reliable statistics), Algeria is a majority-Berber country. Now my impression is that in literature, Berber countries such as Algeria and Morocco are referred as Arab countries. There is (almost) no trace of fights between colonialists and Berbers in North Africa. How can this be explained?
I don't know the answer to the specific question.
But this may help.
There is a novel Only the Valiant by Charles Marquis Warren and a movie based on it Only the Valiant (1951). In it one of the US cavalrymen, Trooper Kebussyan, is called "the Ay-rab".
In the novel, Trooper Kebussyan says that he is an Armenian. But the other soldiers looked in an atlas and couldn't find a country named Armenia in it, and so decided that Kebussyan was a crazy "Ay-rab".
As you may remember, in the 7th century Arabs from Arabia conquered vast regions in the name of Islam. Over the centuries more and more of the population of those countries converted to Islam for increased status. So after a few centuries the vast majority of the populations in most of the regions conquered by the Arabs became Muslims.
And one thing which the converts did as they converted to Islam was to also adopt a strongly Arab influenced lifestyle so as to assimilate into the higher status Arab or Arab influenced classes. That included speaking Arabic. In all of the Arab conquests west of Iran and all the way to Morocco and Spain the majority of the subject people who converted to Islam adopted Arab culture and started speaking Arabic and took Arabic names and began to consider themselves more or less Arabs.
So in that vast region the majority of people in most locations are Arabs by biological ancestry or by long adopted culture, and only minorities are distinct from Arabs.
A person from the Middle East who isn't Iranian or Turkish would be assumed to be Arab by default,despite there being many small non Arab ethnic groups in the region.
And any European visitors to North African who didn't know Arabic wouldn't be able to notice much difference between Arabs who spoke incomprehensible Arabic and Berbers who spoke incomprehensible Berber languages. So basically most European visitors found it hard enough to tell the difference between Turks and Arabs without trying to distinguish between them and Berbers as well.
So it became the usual thing to refer to North Africans as Arabs.
I note that in the novel Beau Geste (1924) by P.C. Wren John Geste shouts:
"Aux armes! Aux armes! Les Arbis! Les Arbis!"
"To Arms! To Arms! The Arabs! The Arabs!" when Fort Zindeneuf is attacked.
Even though that far south, in the Air country, the attackers would be more likely to be Tauregs and thus Berbers than Arabs.
But to the Foreign Legion no doubt "Arabs" was the generic term for all North Africans.