This file is indexed.

/usr/include/wibble/raii.test.h is in libwibble-dev 1.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#if __cplusplus >= 201103L
#include <wibble/raii.h>
using namespace wibble::raii;
#endif

#include <wibble/test.h>


struct TestRAII {
#if __cplusplus >= 201103L
    Test basic() {
        int y = 0;
        {
            auto del = autoDeleter( []() -> int { return 5; }, [ &y ]( int x ) {
                    assert_eq( x, 10 );
                    y = x;
                } );
            assert_eq( y, 0 );
            assert_eq( del.value, 5 );
            del.value = 10;
        }
        assert_eq( y, 10 );
    }

    Test ref() {
        int x = 5;
        {
            auto del = refDeleter( x, []( int &y ) {
                    y = 10;
                } );
            assert_eq( del.value, 5 );
            assert_eq( x, 5 );
        }
        assert_eq( x, 10 );
    }

    Test refIf() {
        int x = 5;
        {
            auto del = refDeleteIf( true, x, []( int &y ) { y = 10; } );
            assert_eq( x, 5 );
        }
        assert_eq( x, 10 );
        {
            auto del = refDeleteIf( false, x, []( int &y ) { y = 15; } );
            assert_eq( x, 10 );
        }
        assert_eq( x, 10 );
    }

    static void delFn( int &x ) { x = 0; }

    Test fn() {
        int x = 5;
        {
            AutoDelete< int & > del( x, delFn );
            assert_eq( x, 5 );
        }
        assert_eq( x, 0 );
    }
#else /* FIXME: workaround */
    void basic() {}
    void ref() {}
    void refIf() {}
    void fn() {}
#endif
};