Skip to content

Commit

Permalink
Added DiffInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Dec 9, 2017
1 parent 7837772 commit 0e88074
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ApprovalTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ set(SOURCE_FILES
StringWriter.h
namers/ApprovalNamer.h
reporters/CommandLauncher.h
reporters/Reporter.h reporters/FirstWorkingReporter.h reporters/DiffReporter.h)
reporters/Reporter.h reporters/FirstWorkingReporter.h reporters/DiffReporter.h reporters/DiffPrograms.h reporters/DiffInfo.h)
add_library(ApprovalTests ${SOURCE_FILES} )
28 changes: 28 additions & 0 deletions ApprovalTests/reporters/DiffInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef APPROVALTESTS_CPP_DIFFINFO_H
#define APPROVALTESTS_CPP_DIFFINFO_H

#include <string>

enum class Type {TEXT, IMAGE, TEXT_AND_IMAGE};

struct DiffInfo
{
DiffInfo(std::string program, Type type) :
program(program),
arguments("%s %s"),
type(type)
{
}
DiffInfo(std::string program, std::string arguments, Type type) :
program(program),
arguments(arguments),
type(type)
{
}
std::string program;
std::string arguments;
Type type;
};


#endif //APPROVALTESTS_CPP_DIFFINFO_H
51 changes: 51 additions & 0 deletions ApprovalTests/reporters/DiffPrograms.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef APPROVALTESTS_CPP_DIFFPROGRAMS_H
#define APPROVALTESTS_CPP_DIFFPROGRAMS_H

#include "DiffInfo.h"

///////////////////////////////////////////////////////////////////////////////
#define ENTRY(name, defaultValue) \
static DiffInfo name() { return defaultValue; }
///////////////////////////////////////////////////////////////////////////////

namespace DiffPrograms {


namespace Mac {
ENTRY(DIFF_MERGE,
DiffInfo("/Applications/DiffMerge.app/Contents/MacOS/DiffMerge", "%s %s -nosplash", Type::TEXT))

ENTRY(BEYOND_COMPARE, DiffInfo("/Applications/Beyond Compare.app/Contents/MacOS/bcomp", Type::TEXT))

ENTRY(KALEIDOSCOPE, DiffInfo("/Applications/Kaleidoscope.app/Contents/MacOS/ksdiff", Type::TEXT_AND_IMAGE))

ENTRY(KDIFF3, DiffInfo("/Applications/kdiff3.app/Contents/MacOS/kdiff3", "%s %s -m", Type::TEXT))

ENTRY(P4MERGE, DiffInfo("/Applications/p4merge.app/Contents/MacOS/p4merge", Type::TEXT_AND_IMAGE))

ENTRY(TK_DIFF, DiffInfo("/Applications/TkDiff.app/Contents/MacOS/tkdiff", Type::TEXT))
}
namespace Linux {
ENTRY(MELD, DiffInfo("meld", Type::TEXT))
}
namespace Windows {
ENTRY(BEYOND_COMPARE_3, DiffInfo("{ProgramFiles}Beyond Compare 3\\BCompare.exe", Type::TEXT_AND_IMAGE))

ENTRY(BEYOND_COMPARE_4, DiffInfo("{ProgramFiles}Beyond Compare 4\\BCompare.exe", Type::TEXT_AND_IMAGE))

ENTRY(TORTOISE_IMAGE_DIFF,
DiffInfo("{ProgramFiles}TortoiseSVN\\bin\\TortoiseIDiff.exe", "/left:%s /right:%s", Type::IMAGE))

ENTRY(TORTOISE_TEXT_DIFF, DiffInfo("{ProgramFiles}TortoiseSVN\\bin\\TortoiseMerge.exe", Type::TEXT))

ENTRY(WIN_MERGE_REPORTER, DiffInfo("{ProgramFiles}WinMerge\\WinMergeU.exe", Type::TEXT))

ENTRY(ARAXIS_MERGE, DiffInfo("{ProgramFiles}Araxis\\Araxis Merge\\Compare.exe", Type::TEXT))

ENTRY(CODE_COMPARE, DiffInfo("{ProgramFiles}Devart\\Code Compare\\CodeCompare.exe", Type::TEXT))

ENTRY(KDIFF3, DiffInfo("{ProgramFiles}KDiff3\\kdiff3.exe", Type::TEXT))
}
}

#endif //APPROVALTESTS_CPP_DIFFPROGRAMS_H
2 changes: 1 addition & 1 deletion to_do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
18. sample project
19. google test
20. windows path separators
21. verify takes reporters with defaults

0 comments on commit 0e88074

Please sign in to comment.