CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/metasploit/framework/compiler/utils_spec.rb
Views: 11789
1
require 'spec_helper'
2
require 'metasm'
3
require 'metasploit/framework/compiler/windows'
4
5
RSpec.describe Metasploit::Framework::Compiler::Utils do
6
describe '#self.normalize_code' do
7
let(:c_template) {
8
%Q|#include <Windows.h>
9
int main(void) {
10
MessageBox(NULL, "Hello World", "Test", MB_OK);
11
return 0;
12
}
13
|
14
}
15
16
it 'returns the raw source code' do
17
headers = Metasploit::Framework::Compiler::Headers::Windows.new
18
source_code = Metasploit::Framework::Compiler::Utils.normalize_code(c_template, headers)
19
expect(source_code).to include('#define APIENTRY WINAPI')
20
end
21
end
22
end
23