You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: TestFileStorage.m
    path of file: ./repos/mexopencv/test/unit_tests
    
    the code of the file until where you have to start completion: classdef TestFileStorage
    %TestFileStorage

    methods (Static)
        function test_write_read_extensions
            S = struct('field1',magic(4), 'field2','a second field');
            exts = {'.xml', '.yml', 
    
function test_write_read_extensions
            S = struct('field1',magic(4), 'field2','a second field');
            exts = {'.xml', '.yml', '.xml.gz', '.yml.gz', '.json', '.json.gz'};
            for i=1:numel(exts)
                fname = [tempname() exts{i}];
                cleanObj = onCleanup(@() delete(fname));

                cv.FileStorage(fname, S);
                assert(exist(fname, 'file') == 2, ...
                    'Failed to write %s file', exts{i});

                S2 = cv.FileStorage(fname);
                validateattributes(S, {'struct'}, {'scalar'});

                if ~isempty(strfind(exts{i}, 'json'))
                    %TODO: for some reason top-level node names are reported
                    % as empty in JSON format
                    continue;
                end