Skip to content

Commit

Permalink
[tests] Add a non-server-driver version of get_project test
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Jun 10, 2024
1 parent 2e7871b commit 99c44c1
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_get_project_new/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CXrefs
.c-xrefrc
*buffer
*.output
output
output.tmp
log
*.log
19 changes: 19 additions & 0 deletions tests/test_get_project_new/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include ../Makefile.boilerplate


ARGUMENTS = -xrefactory-II -olcxgetprojectname $(CURDIR)/index.c

$(TEST): CXrefs
$(COMMAND) > output.tmp
$(NORMALIZE) output.tmp | grep -v -w progress > output
$(VERIFY)

trace debug: EXTRA+=--extra="-trace -log=log"
trace: $(TEST)

CXrefs: .c-xrefrc
echo CXREF
$(CXREF) -create

clean:
rm -rf CXrefs output* .c-xrefrc
81 changes: 81 additions & 0 deletions tests/test_get_project_new/browsing.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#include <stdio.h>

/*
Follow instructions in commentaries to check C-Xrefactory source
browser.
*/


void browsing() {
struct ilist {int i; struct ilist *next;} *il;
struct dlist {double d; struct dlist *next;} *dl;

int i,j,k;

// put cursor somewhere on 'i' variable and press F6. Then using
// F3 and F4 inspect all its references. Finally pop references by
// pressing F5.
for(i=0; i<10; i++) printf("i == %d\n", i );

// put cursor on following usages of 'i' and 'j' and check scope
// resolution by pressing F6 followed by F5.
{ int i;
i = i + 1;
j = j + 1;
}

// structure records can be browsed as well, browse 'next' or 'i'
// records for example.
il = il-> next ;

il-> i = 0;

// list all usages of this 'i' by pressing C-F6 (control F6);
// Note: not all environments support inputting "control F6"
i = 0;
/*
'F3' and 'F4' inspect previous-next reference.
in created (right) window:
'mouse-button12' goes to selected reference.
'mouse-button3' pops up menu.
always:
'F7' closes C-Xrefactory window.
*/


// browse 'next' symbol from following line to check resolution
// inside used macros
#define LISTLEN(ll,res) {res=0; for(; ll!=NULL; ll=ll-> next ) res++;}

LISTLEN(dl, k);

// ambiguity handling: put cursor on 'next' symbol and list all
// its usages with C-F6
#define LISTLOOP(ll,ii) for(ll=ii; ll!=NULL; ll=ll-> next )
/*
In the created (left) window:
<space> - select one symbol
o - toggle to other browser window
also:
'mouse-button12' select/unselect symbol.
'mouse-button3' pops up menu.
As usually 'F7' closes new windows.
*/

LISTLOOP(il, NULL) {}
LISTLOOP(dl, NULL) {}


}

// put cursor on the 'include' keyword and move to the included file
// by pressing F6, then return back using F5.

#include <stdlib.h>

/*
Presentation of C-Xrefactory browser is over, F7 will close
C-Xrefactory window and (probably multiple) F5 will bring you back
to index.
*/
7 changes: 7 additions & 0 deletions tests/test_get_project_new/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<information len=<n>>Prescanning classes, please wait.</information>
<information len=<n>>C-xrefactory project: CURDIR</information>
<information len=<n>>CURDIR/browsing.c</information>
<information len=<n>>CURDIR/index.c</information>
<information len=<n>>CURDIR/source.c</information>
<information len=<n>>Generating 'CURDIR/CXrefs'</information>
<sync>
40 changes: 40 additions & 0 deletions tests/test_get_project_new/index.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Welcome to the C-Xrefactory exercise project!
1.) The basic hot-keys you need to know are: F6 which brings you to
the definition of a symbol, and F5 which brings you back.
2.) With this knowledges you can browse demonstration files. Put
cursor on a function name, say 'completions', and press F6 to go to
completion's examples.
At the first invocation C-Xrefactory will ask you for creation of a
new project. You should answer 'yes' (create new project).
C-xrefactory will then ask a few questions, if you do not know
the answer, press <return> to select default value.
*/


void completions();
void browsing();
void ideCompileAndRun();


// refactorings
void addRemoveParameter();
void extractFunction();
void renameSymbol();





/*
Under Emacs/XEmacs, you can get help on any of C-Xrefactory
functions by typing 'C-h k' key combination (i.e. 'control'
together with 'h' key, followed by 'k' key) and select the function
from 'C-xref' menu with mouse.
*/
5 changes: 5 additions & 0 deletions tests/test_get_project_new/source.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int single_int_on_line_1_col_4;
int single_int_on_line_2_col_5;

single_int_on_line_1_col_4 = 3;
single_int_on_line_2_col_5 = 5;

0 comments on commit 99c44c1

Please sign in to comment.